LINUXSHELLHereDocuments


今天学到一个Linux Bash的新词语,Here docuemnts。

Frequently, your script might call on another program or script that requires input. The here document provides a way of instructing the shell to read input from the current source until a line containing only the search string is found (no trailing blanks). All of the lines read up to that point are then used as the standard input for a command.

简答的说,就是直接将需要的文件内容写到Bash一起。
echo "These are the web browsers on this system:"
 
# Start here document
cat << BROWSERS
mozilla
links
lynx
konqueror
opera
netscape
BROWSERS
# End here document 

从上面可以看出,以BROWSERS开始,到BROWSERS结束为一个文档。

相关内容

    暂无相关文章