Bash - sftp simple script problem

Hello,
when running the scripts below I am not getting message bb2.
Can you please help?

 #!/bin/bash
TLOG=/tmp/bb/amatest.log
FTPRESULTS=/tmp/bb/amlist
export TLOG FTPRESULTS
 
>$TLOG
>$FTPRESULTS
 
echo bb1
 
sftp -oPort=2222 XXXXXXXXXXXXX@sftp.userssedi.com  <<EOF
cd download
ls
quit
        EOF
 
echo bb2
  
 ./bbb
 [root@towhee scripts]# ./bbb
bb1
Connecting to sftp.userssedi.com...
sftp> cd download
sftp> ls
testfile
sftp> quit

Thank you
Biljana

Please add CODE tags (as required by forum rules) to your post. Without them we can't tell where your script ends, we can't tell if spacing at the start of various lines in your script is a problem, and we can't tell what is intended to be output produced by your script.

Please also indicate the name of your script.

What's the contents of "/tmp/bb/amlist" after running the script?

Sorry this is my script again (called bbb)

amlist is blank file (not important here because scripts doesn't use it).
Also log amatest.log is empty.

Biljana

Try removing EOF 's indentation. Read about "Here documents" in man bash .

Yay! It works. Thank you very much RudiC:b:

And thanks for a document, found it.

Here Documents
This type of redirection instructs the shell to read input from the
current source until a line containing only word (with no trailing
blanks) is seen. All of the lines read up to that point are then used
as the standard input for a command...

Have a great day!

Biljana