In bash, when I write this line
new_line="new\nline"
I get this as expected:
echo $new_line
new\nline
And this also works as expected:
echo -e $new_line
new
line
as it says in a manual: -e enable interpretation of backslash escapes
However, this doesn't give me an interpreted \n
new line character:
cur_log=$(who)
echo -e $cur_log
myuser pts/0 2017-01-19 07:10 (:0) myuser pts/1 2017-01-19 09:26 (:0) myuser pts/4 2017-01-19 09:14 (:0)
I thought that there is no new line character but if I write:
echo "$cur_log"
I get new line character interpreted.
myuser pts/0 2017-01-19 07:10 (:0)
myuser pts/1 2017-01-19 09:26 (:0)
myuser pts/4 2017-01-19 09:14 (:0)
Why doesn't echo -e $cur_log
interpret new line character but `echo -e $new_line does?