#!/bin/bash
cat << !HER!
hello
this is a here
document
!HER!
62.txt
this is line 1
this is line 2
this is line 3
this is line 4
62.sh#!/bin/bash
ed 62.txt << !HER!
3
d
.,\$s/is/was/
w
q
!HER!
exit 0
本文档通过几个具体的示例展示了如何使用Bash脚本来创建简单的here文档,并演示了基本的编辑操作。其中包括使用cat命令来创建here文档,以及利用ed编辑器进行文本替换和保存等操作。
#!/bin/bash
cat << !HER!
hello
this is a here
document
!HER!
62.txt
this is line 1
this is line 2
this is line 3
this is line 4
62.sh#!/bin/bash
ed 62.txt << !HER!
3
d
.,\$s/is/was/
w
q
!HER!
exit 0
被折叠的 条评论
为什么被折叠?