Here is a script to change the desktop picture without relaunching the Finder (as was required in the method listed in
this hint). I've included an example I use to get a webcam image and make that image the desktop. Customize at will. The trick is using osascript to run an AppleScript program. Here's the script:
#!/bin/csh -f
rm -f ./BURLINGTONLARGE.JPG
wget http://www.hazecam.net/images/photos-large/
BURLINGTONLARGE.JPG >& /dev/null
set pic=BURLIGNTONLARGE.JPG
set here=`pwd`
set myFile=$here/$pic
/usr/bin/osascript <<END
tell application "Finder"
set pFile to POSIX file "$myFile" as string
set desktop picture to file pFile
end tell
END
NOTE: The 'wget' line has been broken into two rows for easier reading. Enter it as one line with no spaces between the "/" and the "BUR..." bit. Save the script, make it executable (chmod 755), and it's ready for use!