Use EOF in the IF condition in SHELL script

Source: Internet
Author: User
In The SHELL script, IF conditions use EOF because you need to cyclically extract the files to be uploaded according to the conditions ls, and then ftp these files to the specified server. At the beginning, there was no end EOF because there was no top level. the error "& quot; unexpectedendoffile" was always reported. after modification, there was still an error. after checking, the if condition... in The SHELL script, IF conditions use EOF because you need to cyclically extract the files to be uploaded according to the conditions ls, and then ftp these files to the specified server. The end EOF is not ended at the beginning, and the error "unexpected end of file" is always reported. after modification, an error still exists. after check, if condition [] is used; otherwise, no fi is found. normally, if the if condition does not have EOF, there is no; there is no problem. We hereby record FILLIST = 'ls $ {filename} 'for FILE in $ FILLIST do if [-f $ FILE]; then echo "############ begin to upload ############" ftp-inv <EOF open 192.168.1.1 user username pass cd/path binary mput $ FILE close bye EOF # backup mv "$ FILE" $ {destpath} fi
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.