I need to run a script remotely. I am using the following shell script
for server in $servers
do
LOCAL_VAR=<some_value>
ssh $server <<EOF
command1 $LOCAL_VAR
command2..
..
exit
EOF
done
bash shows unexpected end of file syntax error. The rest of the code works fine if I remove this block. Can you please tell me the correct way of executing a script remotely.
If you want to put indentation like that in your
here-doc, you should add a-like the following code :Take care when you copy paste this, sometimes you can have surprises with tabs or spaces.