Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to remove leading \t?



I'm reading the bash book from O'Reilly now, and I've learned about
pattern match and substitution operators. For instance, if you have

var1='foobar'
var2=${var1#foo}

then var2 is 'bar'. What I haven't been able to figure out, is how to
remove a leading tab from a variable value. The bash book says to do

${var#\t}

but when I try this it doesn't work. I've tried various combinations of
single quotes and double quotes, but nothing seems to work. In the end
I've resorted to just using the substring operator

${var:1}

but this isn't exactly elegant. :-( Is there a better way to do this?

And as an aside, have other people found the bash book to be pretty
sloppy? I find that a disturbingly large percentage of the sample scripts
etc. don't work as advertised. I've had to figure a lot of the stuff out
on my own after experimenting around a bit.

-- 
Ken Gosier
ken at kg293.net
ken_gosier at yahoo.com






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org