To create or update the test.txt
file using the following command:
$ cat << EOF > test.txt
This is the first line.
This is the second line.
EOF
- The
cat << EOF > test.txt
command creates (or updates if the file already exists) a file namedtest.txt
and writes the specified content into it. - Everything between
EOF
and the secondEOF
is written into the file. - This command adds two lines to
test.txt
:- "This is the first line."
- "This is the second line."
After running this command, your test.txt
file will contain the following:
This is the first line.
This is the second line.