The AppleScript (I called it "applesetroot.scpt"):
tell application "Finder"
set currentPicture to ((the desktop picture) as string)
end tell
(* change Finder : delimiters to Unix / delimiters *)
(* get the parts of the path *)
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set picturePathParts to text items of currentPicture
(* trim off the name of the disk *)
set theLengthOfPicturePathParts to the ¬
length of picturePathParts
set picturePathParts to items 2 thru ¬
theLengthOfPicturePathParts of picturePathParts
(* fill in / delimiters *)
set ReplaceString to "/"
set AppleScript's text item delimiters to ReplaceString
set unixPicturePath to picturePathParts as text
set AppleScript's text item delimiters to OldDelims
set unixPicturePath to "/" & unixPicturePath
unixPicturePath
The shell script wrapper ("applesetroot")
#!/bin/sh
FILEPATH=`osascript /Users/tim/bin/applesetroot.scpt`
/sw/bin/Esetroot -scale -center $FILEPATH
Caveat: I still haven't figured out how to make this work with a rotating background image. Finder still thinks "desktop picture" is whatever it was set to before rotation was selected.
[robg adds: I haven't tested this one...]

