How can I create a file by using cat in a bash script?
The commands below work fine through the shell, but not as a script:
cat > list.txt
Orange
Apple
Grape
Kiwi
Papaya
Banana
Strawberry
Blueberry
Peach
Pear
CTRL-D
Use a here document within a script:
$ cat > list.txt <<EOF
Orange
Apple
Grape
Kiwi
Papaya
Banana
Strawberry
Blueberry
Peach
Pear
EOF
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