How to remove leading \t?
Ken Gosier
ken at kg293.net
Wed Feb 12 17:11:46 EST 2003
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
More information about the Discuss
mailing list