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

Re: Shell script - insert newline into string

by Thomas Reitmayr-2 :: Rate this Message:

Reply to Author | View in Thread

message="abc
def"
echo "$message"

should work. Did you put the quotes around $message in your echo
command?
-Thomas

Am Sonntag, den 14.06.2009, 10:37 +0000 schrieb Tony Wilson:

>
>
> Hi
>
> I'm kind of embarrassed to ask this but I'm stuck!
>
> I'm writing a shell script and need to insert a line feed into a
> string. For some reason \n does not work on the NSLU2.
> Nor does stuff like:
>
> message="Subject:Test
>
> Body of message here"
>
> (ie newline within string)
>
> Echo is not adding a new line when used to extend the string.
>
> Please help!!!!
>
> Tony
>
>
>
>
>

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