[plug] bash, echo and tabs

Steve Boak sboak at westnet.com.au
Wed Aug 6 12:00:47 WST 2008


Hi

I'm trying to format some output from a bash script, and there's something
I just can't seem to figure out or find a reference to.

if I type "df -h /mnt", I get
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             2.0G  125M  1.9G   7% /

however if I type "echo `df -h /mnt`", I get
Filesystem Size Used Avail Use% Mounted on /dev/hda3 2.0G 125M 1.9G 7% /

with all the tabs and the CR replaced by spaces.

I've tried "echo -e", but that doesn't work as the tabs aren't escaped in
the "df" output string.

Just in case you want to know...
Debian Etch, Linux 2.6.18-5-686
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)

Any suggestions?

Thanks

Steve

-- 
Steve Boak, (08) 9756 0662, P.O. Box 240, Nannup, WA 6275
Nannup Telecentre IT support, ph (08) 9756 3022
Engin (VoIP) number (08)64616187 (Local number in Perth)




More information about the plug mailing list