How can I have a newline in a string in sh?
Posted
by juannavarroperez
on Stack Overflow
See other posts from Stack Overflow
or by juannavarroperez
Published on 2010-06-09T13:00:21Z
Indexed on
2010/06/09
13:02 UTC
Read the original article
Hit count: 181
sh
This
STR="Hello\nWorld"
echo $STR
produces as output
Hello\nWorld
instead of
Hello
World
What should I do to have a newline in a string? I'm aware of echo -e
, but I'm no sending the string to echo
, the string will be used as an argument by another command that doesn't know how to interpret \n
as a newline.
© Stack Overflow or respective owner