$ echo "line\nnewline" line\nnewline $ echo -e "line\nnewline" line newline $ lines=`echo -e "line\nnewline"` $ echo $lines line newline $ echo "$lines" line newlineClearly you must use -e if you want echo to recognize newline escape character (\n). In addition notice how quotes are needed to print the new line stored in a variable while the -e option is not needed.
Monday, July 16, 2012
echo-ing new lines in bash
For the sake of our memories:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment