echo newline character not working in bash

Posted by Bashuser on Super User See other posts from Super User or by Bashuser
Published on 2011-03-11T20:56:53Z Indexed on 2011/03/12 0:12 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

I have bash script which has lots of echo statements and also I aliased echo to echo -e both in .bash_profile and .bashrc, so that new lines are printed properly for a statement like echo 'Hello\nWorld' the output should be

Hello
World

but the output I am getting is

Hello\nWorld

I even tried using shopt -s expand_aliases in the script, it doesn't help

I am running my script as bash /scripts/scriptnm.sh; if I run it as . /scripts/scriptnm.sh I am getting the desired output...

© Super User or respective owner

Related posts about linux

Related posts about bash