cat <<EOF> file

.多行导入文件(新建文件或者覆盖文件内容)
 
cat << EOF > abcd.txt
Hello!
This is a test file!
Test for cat and EOF!
EOF
 
来看下执行结果
 
cat abcd.txt
Hello!
This is a test file!
Test for cat and EOF!
这就是多行导入!
 
用法2.文件追加
cat << EOF >> test.sh
 
3:说明
其实可以用其他字符来代替EOF,它也只是个标识符而已!
原文地址:https://www.cnblogs.com/hanxing/p/4153712.html