Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash echo multiline to file

# possibility 1:
echo "line 1" >> greetings.txt
echo "line 2" >> greetings.txt

# possibility 2:
echo "line 1
line 2" >> greetings.txt

# possibility 3:
cat <<EOT >> greetings.txt
line 1
line 2
EOT
Source by unix.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #bash #echo #multiline #file
ADD COMMENT
Topic
Name
2+1 =