Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

HEREDOC script into var

VAR=$(cat <<'END_HEREDOC'
abc'asdf"
$(dont-execute-this)
foo"bar"''
END_HEREDOC
)

# this will echo variable with new lines intact
echo "$VAR"
# this will echo variable without new lines (changed to space character)
echo $VAR
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #HEREDOC #script #var
ADD COMMENT
Topic
Name
6+5 =