13
5
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...
3aliasing
echo
like you want is a bad practice IMHO – shellholic – 2011-03-11T21:02:49.6031Use double quotes to that the \n gets interpreted. Single quotes prevent the interpretation of the \n and a bunch of other things. – BillThor – 2011-03-12T01:13:28.980