[sclug] Bash boohoo
J. Mann
jon at spinis-associates.co.uk
Sat Oct 25 09:05:36 UTC 2003
On Monday 14 April 2003 4:07 pm, pieter claassen wrote:
> RESULT=`brctl show` # returns three lines of info on bridge info
> echo $RESULT #prints all three lines on one line
>
> Why does the last line not honour the "\n" (0x0a)?
Because it is in the Internal Field Seperator (IFS).
The default IFS is a space, a tab and a newline.
> But more important, how do I fix this?
Well, you could change the IFS to nothing:
RESULT=`brctl show`
IFS=
echo $RESULT
or, as already suggested, quote the string:
RESULT=`brctl show`
echo "$RESULT"
Regards,
Jon.
More information about the Sclug
mailing list