Posted on Leave a comment

Open and write data to text file using bash/shell scripting – Stack Overflow

#!/bin/sh

FILE="/path/to/file"

/bin/cat <<EOM >$FILE
text1
text2
text3
text4
EOM

If you want to write directly the command is echo 'text'

$ echo 'Hello World' > file

Source: Open and write data to text file using bash/shell scripting – Stack Overflow

Leave a Reply

Your email address will not be published. Required fields are marked *