[Pharo-users] pharo bash script with startup

Tim Mackinnon tim at testit.works
Wed Jun 27 14:58:20 EDT 2018


When we get confirmation of success - we need to make sure this gets applied to both zeroconf and official downloads.

Anything we can do to simplify and make it robust is gratefully appreciated as there is nothing worse than falling at the lunch hurdle.

It’s cool to see so many clever minds on this.

Tim

Sent from my iPhone

> On 27 Jun 2018, at 19:52, Hernán Morales Durand <hernan.morales at gmail.com> wrote:
> 
> 2018-06-27 10:50 GMT-03:00 K K Subbu <kksubbu.ml at 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
>> 
> 




More information about the Pharo-users mailing list