SFTP problem

i have a problem no a dream :slight_smile:
i have a list and i want to do :

cat lista_olo
for file in `cat list`
do
sftp myuser@myip << EOF
ls -l  mydir/$file/
EOF

but there is an error . Syntax error at line 11 : `<' is not matched
How can i do ?
Regards.

Well, this is confusing to start off.

  • Firstly, what shell are you using?
  • What is the content of the file lista_olo and what purpose is it? It doesn't seem to be used anywhere else.
  • Your loop is a poor choice, you would be better with:-
    text while read file do something done < list

What is the overall point of you code? If you can describe it a bit more fully, we may be able to direct you to a more suitable solution.

Maybe it is as simple as removing the space between << & EOF ? I haven't tried.

Kind regards,
Robin