之前编辑文件都是用vim 命令,最近看视频学到一个用cat > 进行交互输入,感觉这样更方便
root@ubuntu:/home/koyaku# script create_file_use_cat.txt
Script started, file is create_file_use_cat.txt
root@ubuntu:/home/koyaku# cat createfile.txt
cat: createfile.txt: No such file or directory
root@ubuntu:/home/koyaku# cat > createfile.txt
a
b
c
d
end
u^Hend use ctrl +d
root@ubuntu:/home/koyaku# cat createfile.txt
a
b
c
d
end
end use ctrl +d
root@ubuntu:/home/koyaku#
ctrl-d: ( Terminate input, or exit shell ) 一个特殊的二进制值,表示 EOF,作用相当于在终端中输入exit后回车;