Linux Linux cat EOF basis of usage resolve


Keywords: linux shell cat EOF end of file


1. cat <file << EOF is how to use the

Create the file, and then back at any things that are to enter the contents of the file.

After the input is complete, ending with EOF, represents the input end.

cat > 1.txt <<EOF
1
2
3
4
5
EOF



2. cat << EOF and cat << - EOF of difference

2.1 cat << EOF

cat << EOF
Hello!
EOF

2.2 cat <<- EOF

cat <<- EOF
Hello!
     EOF

2.3 Notes

Under normal circumstances, EOF have to write the top line, otherwise it will be taken as input.

Use the << - will be able to avoid this from happening.


Finally: Reference Document

1.cat> file << EOF usage https://www.cnblogs.com/chenjingchao/p/6259572.html

Published 204 original articles · won praise 59 · Views 140,000 +

Guess you like

Origin blog.csdn.net/baidu_34122324/article/details/105175368