shell脚本中的读文件(while read line)与写文件(here document)
shell脚本中如何读取外部文件并进行相关操作呢?范式如下,是要背滴:
while read line;
do
process $line
done < file
如何在写中将内容写入新文件呢,要用到here document,一种特殊的重定向技术,小范式如下,也是要牢记在心的:
cat << EOF > output.txt
echo "hello"
echo ...
转载
2019-04-22 00:07:41 ·
791 阅读 ·
0 评论