When linuxshellwhile reads the file, an error is reported. when... do reads the file, an error is returned. Script name: while_readFile.sh script content: Shell code #! /Bin/shwhilereadLINEabcdoecho $ LINE & lt; strong & gt; & lt; spanstyle & quot; color... for linux shell while reading files, an error is reported... when do reads data from a file, an error is returned. Script name: while_readFile.sh script content: Shell code #! /Bin/sh while read LINE abc do echo $ LINE
Done <(cat./a.txt)Note: There is a space between 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
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.