Mac: Getting path of current desktop picture from terminal
I found that the answer can be shortened to one line:
osascript -e 'tell app "finder" to get posix path of (get desktop picture as alias)'
Like this:
osascript -e '
tell application "Finder"
set theDesktopPic to desktop picture as alias
set theName to posix path of theDesktopPic
end tell'
/Users/mark/Documents/Carbon fibre.png