local current_val="$1" operator="$2" test_value="$3"
awk -vv1="$current_val" -vv2="$test_value" 'BEGIN {
split(v1, a, /\:/);
- if (a[2] == '$test_value') {
- exit (a[2] == '$test_value') ? 0 : 1
+ if (a[2] == '"$test_value"') {
+ exit (a[2] == '"$test_value"') ? 0 : 1
}
else {
- exit (a[2] '$operator' '$test_value') ? 0 : 1
+ exit (a[2] '"$operator"' '"$test_value"') ? 0 : 1
}
}'
}
mkdir -p "$(dirname "$insert_file")"
rm -f "$insert_file"
- echo "" >> "$insert_file"
- echo "//////////////////////////////////////////////////" >> "$insert_file"
- echo "// Cloud config for $(basename "$cloud")" >> "$insert_file"
- echo "//////////////////////////////////////////////////" >> "$insert_file"
- echo "" >> "$insert_file"
+ {
+ echo ""
+ echo "//////////////////////////////////////////////////"
+ echo "// Cloud config for $(basename "$cloud")"
+ echo "//////////////////////////////////////////////////"
+ echo ""
+ } >> "$insert_file"
+
echo "templates = []" >> "$insert_file"
mapfile -t templates < <(find "$cfg_dir" -maxdepth 1 -not -type d -not -name "cloud.cfg")