[Pharo-users] pharo bash script with startup

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


On Wednesday 27 June 2018 01:08 PM, Otto Behrens wrote:
> I am running with an absolute image path.
> 
> The issue is definitely exec "$image" in the script. If I remove the
> "", i.e. exec $image, then it works.

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.

Also, the image_count should be checked before calling zenity.

Can you try with this version?

````
if [ $# -eq 0 ]; then
	image_count=`ls "$RESOURCES"/*.image 2>/dev/null |wc -l`
	if [ "$image_count"  -eq 1 ]; then
		image="$RESOURCES"/*.image
	elif which zenity &>/dev/null; then
		image="$(zenity --title 'Select an image' --file-selection --filename 
"$RESOURCES/" --file-filter '*.image' --file-filter '*')"
	else
		image="$RESOURCES/Pharo6.1-64.image"		
	fi
else
	image="$@"
fi

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

HTH .. Subbu



More information about the Pharo-users mailing list