2013-09-27 189 views
1

林在bash腳本新伊夫遇到了一個問題 這裏是我的腳本的例子bash腳本SFTP退出終止腳本

NOW=$(date +"%m-%d-%Y-%H") 

echo -e "\nSFTP connection" 
sftp [email protected] <<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" 

} 

當IM關閉與FTP連接的腳本將會停止,犯規返回第二部分腳本:(的

請給我什麼建議,即時通訊做錯了

謝謝!

+0

請向我們展示整個腳本。 – konsolebox

+2

在腳本的左邊緣是否有'EOT'?它不會被識別,如果它縮進。 – Barmar

+1

您可以使用'<< - EOT',它允許'EOT'縮進,但是_only_只能使用TAB字符,而不能使用空格。 – Barmar

回答

1

是EOT在Le腳本的腳邊?它不會被識別,如果它縮進。 - Barmar

您可以使用< < -EOT,它允許縮進EOT,但只能使用TAB字符,而不能使用空格。 - Barmar