I'd like to pass a file name via a default script parameter into a bash script which calls an osascript, but am running into problems.
I've been fiddling around with something like the below, but am continually getting errors. The script does work perfectly if I hard-code the full path, and the file exists, so it must be something to do with pulling in the parameter.
$4 is set to green.png in my policy
Any ideas out there?
#!/bin/sh
if [ "$4" != "" ]
then
osascript -e 'tell application "System Events" to set picture of every desktop to ("/Library/Desktop\\\\ Pictures/$4" as POSIX file as alias)'
fi
exit 0