Try:
string="`echo -e 'A\nB\nCDE\nF'`"
echo "$string"
-Thomas
Am Sonntag, den 14.06.2009, 17:53 +0000 schrieb Tony Wilson:
>
>
> --- In
nslu2-linux@..., Kumar Appaiah <a.kumar@...> wrote:
> >
> > On Sun, Jun 14, 2009 at 10:37:11AM -0000, Tony Wilson wrote:
> > > 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.
> >
> > Here's one way:
> >
> > [kumar@bluemoon ~] echo -e "A\nB\nCDE\nF"
> > A
> > B
> > CDE
> > F
> >
> > i.e., the use of "-e" recoginized backslash escape sequences.
> >
> > HTH.
> >
> > Kumar
> > --
> > Kumar Appaiah
> >
>
> That works from the command line, but not in script!
>
> string=`echo -e "A\nB\nCDE\nF"`
> echo $string
>
> output:
> A B CDE F
>
>
>
>
>