首页 > 其他 > 详细

LINUX SHELL Here Documents

时间:2014-01-24 06:50:41      阅读:329      评论:0      收藏:0      [点我收藏+]


今天学到一个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结束为一个文档。



LINUX SHELL Here Documents

原文:http://blog.csdn.net/xfzheng_yeah/article/details/18708821

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!