2018-06-27 10:50 GMT-03:00 K K Subbu <kksubbu...@gmail.com>:
> On Wednesday 27 June 2018 06:39 PM, K K Subbu wrote:
>>
>>
>> The double quotes are required here to skip splitting arguments with
>> embedded spaces into different words.
>>
>> I suspect the error is earlier in the image=$@ assignment. This requires
>> double quotes. Double quotes are also required while calling zenity to avoid
>> word splitting.
>
>
> My earlier fix is also in error, Sorry!
>
> Essentially, we are mixing up single value variable (image) with argument
> array ($@). I found a cleaner fix :
>
> ````
> if [ $# -eq 0 ]; then
>         image_count=`ls "$RESOURCES"/*.image 2>/dev/null |wc -l`
>         if [ "$image_count"  -eq 1 ]; then
>                 set -- "$RESOURCES"/*.image
>         elif which zenity &>/dev/null; then
>                 set -- "$(zenity --title 'Select an image' --file-selection
> --filename "$RESOURCES/" --file-filter '*.image' --file-
> filter '*')"
>         else
>                 set -- "$RESOURCES/Pharo6.1-64.image"
>         fi
> fi
>

Use $() instead of backticks for command substitution:
http://mywiki.wooledge.org/BashFAQ/082

Cheers,

Hernán

> # execute
> exec "$LINUX/pharo" \
>         --plugins "$LINUX" \
>         --encoding utf8 \
>         -vm-display-X11 \
>         "$@"
> ````
>
> HTH .. Subbu
>

Reply via email to