« Return to Thread: Shell script - insert newline into string

Re: Re: Shell script - insert newline into string

by LrdShaper :: Rate this Message:

Reply to Author | View in Thread

Brendon Oliver-2 wrote:
On Mon, 15 Jun 2009 03:53:17 am Tony Wilson wrote:

> That works from the command line, but not in script!
>
> string=`echo -e "A\nB\nCDE\nF"`
> echo $string
>
> output:
> A B CDE F
Why the need to put echo itself in the string? Why not:
string="A\nB\nCDE\tF"
echo -e $string

Cheers!

 « Return to Thread: Shell script - insert newline into string