I am wondering how I can implement something like the following:
test(){
cat>file<<'EOF'
abc
EOF
}
Many thanks.
This operator stands for the end of the file. This means that wherever a compiler or an interpreter encounters this operator, it will receive an indication that the file it was reading has ended.
The “cat” command in Bash stands for “concatenate”. This command is very frequently used for viewing, creating, and appending files in Linux. Today, we will explain to you the usage of this command in Bash in Linux Mint 20 by sharing some examples.
cat is one of the most frequently used commands in Unix operating systems. cat is used to read a file sequentially and print it to the standard output. The name comes from the way it can concatenates files.
Qiang:
Remove the spaces in front of EOF (so it's on a line by itself and not indented).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With