In Bash, tried this:
echo -e "hello\nworld"
But it doesn't print a newline, only \n. How can I make it print the newline?
I'm using Ubuntu 11.04.
Answer
You could use printf instead:
printf "hello\nworld\n"
printf has more consistent behavior than echo. The behavior of echo varies greatly between different versions.
No comments:
Post a Comment