I'm used to use cat > /path/to/file << EOF
when I, in a bash script, printed more than one line into a file... I was checking old code of my company and I found the cat EOT
instruction instead of the cat EOF
I'm used to (please notice the T instead of the F at the end of it) and curiosity bit me.
I did a quick research and I only found this other question, but I think it was not related to what I wanted to know.
I did some tests with the following code:
password=hello
cat > ./hello.txt << EOT
authentication {
auth_type PASS
auth_pass $password
}
EOT
And I get the exact same output as when I use EOF
instead of EOT
. The output is, as expected:
root@test_VM:~# bash test.sh && cat hello.txt
authentication {
auth_type PASS
auth_pass hello
}
So the questions are:
- What are the differences between the use of
EOT
andEOF
? - When should I use one over the other?