Reputation: 1687
There's a snippet code here.
$ a=aa
$ b=bb
$ echo -e $a"\t"$b
aa bb
$ c=`echo -e $a"\t"$b`
$ echo $c
aa bb
$ echo -e $c
aa bb
I wanna concat the $a and $b with tab, and set the result to variable c for a further use.
But When I echo $c, no tab display, only a space.
What should I do?
Upvotes: 1
Views: 7622
Reputation: 14949
Try this:
echo "$c"
You need to quote the variable. Moreover, since you already interpreted the escape sequence during the assignment to c
, you don't need to specify -e
while echoing the value.
Upvotes: 4