shell脚本执行出错syntax error: unexpected end of file,

今天执行shell脚本时出错,syntax error: unexpected end of file 

 ./wang_an_create_zip_upload_server_order.sh: line 246: syntax error: unexpected end of file

出现这个情况一般有两种,第一种,编码,dos 和unix ,这里不再赘述,

此次,我遇到的,是疏忽,编写脚本是,代码格式问题,使用<< EOF ,

后面的EOF必须顶格写,否则就会报错。

如下,是上传文件到sftp的shell代码,

      lftp -u ${SFTP_USER},${SFTP_PASS} sftp://${SFTP_HOST}:${SFTP_PORT} << EOF
					cd '/write'
					lcd ${TSK_ZIP_PATH}
					put ${FILE_NAME_ACCOUNT}.zip ${FILE_NAME_ACCOUNT}.zip
					bye
EOF

猜你喜欢

转载自blog.csdn.net/RUIMENG061511332/article/details/85245527