-
Notifications
You must be signed in to change notification settings - Fork 14
/
generate_scripts.sh
39 lines (30 loc) · 1.13 KB
/
generate_scripts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
. $(dirname "$0")/configuration.sh
vers=($(./get_unity_versions.sh | sed s/a/.a./g | sed s/b/.b./g | sed s/f/.f./g | sed s/p/.p./g | sort -t. -k1,1n -k2,2n -k3,3n -k4,4d -k5,5n | sed s/.a./a/g | sed s/.b./b/g | sed s/.f./f/g | sed s/.p./p/g))
# First argument is the file
# Second argument is the reference script
# Third argument is the command to be used on each version
function generate() {
echo "#!/bin/bash" > "$1"
echo ". \$(dirname \"\$0\")/$2" >> "$1"
for ((i=0; i<${#vers[@]}; i++));
do
echo "$3 ${vers[i]}" >> "$1"
done
}
# First argument is the file
# Second argument is the reference script
# Third argument is the command to be used on each version
function generate_forced() {
echo "#!/bin/bash" > "$1"
echo ". \$(dirname \"\$0\")/$2" >> "$1"
for ((i=0; i<${#vers[@]}; i++));
do
echo "$3 ${vers[i]} --force" >> "$1"
done
}
generate check_all.sh check_functions.sh check_any_version
generate dump_all.sh dump_functions.sh dump
generate extract_all.sh extract_functions.sh extract
generate_forced dump_all_forced.sh dump_functions.sh dump
generate_forced extract_all_forced.sh extract_functions.sh extract