What is eof in linux

WBOY
WBOYOriginal
2022-05-07 16:26:415562browse

In Linux, eof is a custom terminator, which is the abbreviation of "END Of File"; because it is a custom terminator, eof is not fixed, and you can set an alias at will. In Linux, press "ctrl d" represents eof. Eof is generally used with the cat command for multi-line text output, which refers to the end of the file.

What is eof in linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is eof in Linux

EOF is the abbreviation of END Of File, which represents a custom terminator.

Since it is customized, EOF is not fixed and you can set an alias at will.

Pressing ctrl-d in Linux means EOF.

EOF generally cooperates with cat to output multi-line text.

Its usage is as follows:

<<EOF        //开始
....
EOF            //结束

It can also be customized, such as customization:

<<BBB        //开始
....
BBB              //结束

Sample

[root@localhost test]# cat << EOF > test.sh
> 123456789
> abcdefghj
> tdss32323
> EOF
[root@localhost test]# cat test.sh 
123456789
abcdefghj
tdss32323
[root@localhost test]# cat << BBB > test.sh
> dddddddddd
> aaaaaaaaaa
> eeead12133
> BBB
[root@localhost test]# cat test.sh 
dddddddddd
aaaaaaaaaa
eeead12133
如果想追加 cat << EOF >> test.sh

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is eof in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn