On Tue, Mar 23, 2004 at 08:38:12AM -0700, Craig White wrote:
> Q. When is a tab not a tab?
> A. When a shell script inexplicably substitutes spaces for the tab.
Actually, I realized what it was a few minutes after I sent it
(coincidentally, while I was fixing my tea, which I'd not yet had).
It's a shell issue, not echo, and it *is* related to $IFS.
Thinking about it, I realized that by not quoting, you're breaking up
the string into two arguments, which get echoed back with a space
separating them. Using the quotes, it's getting passed as a single
argument, which gets echoed back exactly.
To make it more clear:
echo foo\tbar # There are two arguments here, "foo" and "bar"
echo "foo\tbar" # There is one argument here, "foo\tbar"
When I set $IFS to just " " and then did "echo foo\tbar", it got echoed
back exactly.
The upshot of this that you should be able to drop the "-d' '" from the
cut command if you add quotes around $line in your shell script during
the assignment to $i. Not that it particularly matters which way you do
it, but that's what's going on. As far as the variable assignment issue
I mentioned in the last email, it wasn't variable assignment, it was
beacuse I didn't have quotes around the $i when I was echoing it to pipe
it to od.
--
Bill Jonas * bill@billjonas.com * http://www.billjonas.com/
"It's a dangerous business, Frodo, going out your front door. You step
into the Road, and if you don't keep your feet, there is no knowing
where you might be swept off to." -- Bilbo Baggins