【Linux】使用cat EOF添加、删除文本内容 |
您所在的位置:网站首页 › shell文本编辑最后一行怎么弄 › 【Linux】使用cat EOF添加、删除文本内容 |
1、什么是
EOF是 END Of File的缩写,表示自定义终止符。 既然是自定义,那么 EOF就不是固定的,可以随意的设置别名。其中,在linux中按 ctrl+d就表示 EOF。 EOF一般会配合 cat能够多行文本输出 2、怎么用使用EOF: 开始,执行: 表示输出重定向,执行覆盖所有内容。还可以自定义使用,例如: 开始,执行: this is add_sen 1 > this is add_sen 22222222 > this is add_sen 33333333333 > EOF覆盖文本 # cat /home/test.txt > this is add_sen 1 > this is add_sen 22222222 > this is add_sen 33333333333 > EOF123 在sh脚本中使用 # cd /home/ # rm test.txt # touch test.txt # touch myTest.sh # vim myTest.sh cat > /home/test.txt this is sentence one this. is sentence twooooo this. is. sentence three eof EOF # sh myTest.sh # cat /home/test.txt 输出结果: this is sentence one this. is sentence twooooo this. is. sentence three eof 使用cat EOF追加段落成功。 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |