Friday, 27 September 2013

bash script sftp exit terminate script

bash script sftp exit terminate script

Im new in bash scripting and Ive met a problem here is the example of my
script
NOW=$(date +"%m-%d-%Y-%H")
echo -e "\nSFTP connection"
sftp username@ip <<EOT
lcd local_folder/
cd remote_folder/
mget *.txt
exit
EOT
##here it stops
echo -e "\nNew folder"
cat email_list | while read line
do
mail -s "topic" $line < text.txt
done
echo -e "\nSent"
}
When im closing the connection with ftp the script stops and doesnt return
the second part of the script:(
Please give me suggestions about what im doing wrong
Thank you!

No comments:

Post a Comment