You are not logged in.
The manual page of echo states that you can print newlines if you use the -e option by adding \n to the string, but That isn't working for me. When running "/bin/echo -e top\nbottom" the output will be "topnbottom". Same with printf, running "/usr/bin/printf top\nbottom" give me the output "topnbottom".
This might be specific to bash, since it does print a newline when using fish shell. Those are the only 2 shells installed on my system, though.
What is causing this? It shouldn't be using the buildin echo and printf like that.
Last edited by sharkwouter (2014-10-28 15:23:10)
Offline
Looks like your string must be quoted ("string") in order for echo to interpret special characters.
Offline
Looks like your string must be quoted ("string") in order for echo to interpret special characters.
Oh wow, you are right. Thanks for that one.
Offline
Alternatively you can escape the slash:
$ echo -e "one\ntwo"
one
two
$ echo -e one\\ntwo
one
two"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline