Embedding AppleScript inside a Bash -- getting Error I'm fiddling with bash for the first time and trying to get something simple to work.

#!/bin/bash
    while true ; do
    osascript &lt;&lt;EOF
        tell application "System Events"
            tell every desktop
                set picture to "/Users/bill/Desktop/bckg_changer/ARM_1885.jpg"
            end tell
        end tell
    EOF
done


When I execute this file from the command line, it throws:

Bills-iMac-4:test bill$ ./test.sh
./test.sh: line 11: syntax error: unexpected end of file


I found this question, and the formatting and structure is similar - so not sure what is missing.

The picture changing script itself works - it's when I add the while loop that the end of file error is thrown.

Caveat

I know this script doesn't make sense - the idea was to have a continuous loop, that would revert the desktop picture to the jpg if it was subsequently changed in the System Preferences.  Obviously a poor choice of methods and resource use...  :-)
change

osascript &lt;&lt;EOF


to

osascript &lt;&lt;-EOF


The - lets you indent the terminating EOF.