Linux shell while file reading error Solution

Source: Internet
Author: User

In linux shell while, when reading a file, an error is reported. When... do reads the file, an error is returned. Script Name: while_readFile.sh script content: Shell code #! /Bin/sh while read LINE abc do echo $ LINE <strong> <span style = "color: # 0000ff;"> done <(cat. /a.txt) </span> </strong> Note: there is a space between the two <. The execution result is as follows: [root @ localhost while] #. /while_readFile.sh. /while_readFile.sh: line 5: syntax error near unexpected token '('. /while_readFile.sh: line 5: 'done <(cat. /a.txt) 'if bash is used for execution, there is no problem: [root @ localhost while] # bash while_readFile.sh11: 22aa: bbb: cc: dd is Because sh does not perform the blue mark usage. The script is modified as follows to support sh: Shell code #! /Bin/sh while read LINE abc do echo $ LINE done <./a.txt

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.