Answers for "bash set variable multiple lines"

1

linux set multiline variable

# in a bash script the following works:

#!/bin/sh

text="this is line one\nthis is line two\nthis is line three"
echo -e $text > filename

# alternatively:
text="this is line one
this is line two
this is line three"
echo "$text" > filename

# cat filename gives:
this is line one
this is line two
this is line three
Posted by: Guest on October-10-2021
0

linux set multiline variable

echo | tee /tmp/pipetest << EndOfMessage
This is line 1.
This is line 2.
Line 3.
EndOfMessage
Posted by: Guest on October-10-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language