[Pharo-users] pharo bash script with startup

K K Subbu kksubbu.ml at gmail.com
Wed Jun 27 09:50:23 EDT 2018


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

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

HTH .. Subbu



More information about the Pharo-users mailing list