Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

linux set multiline variable

# in a bash script the following works:

#!/bin/sh

text="this is line one
this is line two
this 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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linux #set #multiline #variable
ADD COMMENT
Topic
Name
6+4 =