Handle single or double quotes

This commit is contained in:
Bob Mottram 2016-09-29 11:19:01 +01:00
parent 64378bb2ef
commit 3fa84aa428
1 changed files with 6 additions and 5 deletions

View File

@ -93,8 +93,6 @@ function detect_apps {
fi fi
done done
echo "Apps available: $APPS_AVAILABLE"
function_check get_apps_installed function_check get_apps_installed
get_apps_installed get_apps_installed
get_apps_installed_names get_apps_installed_names
@ -118,10 +116,13 @@ function choose_apps_for_variant {
APPS_AVAILABLE+=("${app_name}") APPS_AVAILABLE+=("${app_name}")
if grep -q "VARIANTS=" ${filename}; then if grep -q "VARIANTS=" ${filename}; then
variants_list="$(cat ${filename} | grep "VARIANTS=" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')" variants_line=$(cat ${filename} | grep "VARIANTS=")
if [[ "$variants_line" == *"'"* ]]; then
variants_list=$(echo "$variants_line" | awk -F '=' '{print $2}' | awk -F "'" '{print $2}')
else
variants_list=$(echo "$variants_line" | awk -F '=' '{print $2}' | awk -F '"' '{print $2}')
fi
if [[ "${variants_list}" == 'all'* || \ if [[ "${variants_list}" == 'all'* || \
"${variants_list}" == 'any'* || \
"${variants_list}" == 'full'* || \
"${variants_list}" == "$variant_name "* || \ "${variants_list}" == "$variant_name "* || \
"${variants_list}" == *" $variant_name "* || \ "${variants_list}" == *" $variant_name "* || \
"${variants_list}" == *" $variant_name" ]]; then "${variants_list}" == *" $variant_name" ]]; then