Sometimes, it doesn't pay to get outta bed in the morning.
There are a lot of people who responded, too numerous to mention...
The original problem:
Okay, try this:
Make a plain text file called bob containing the following three lines:
Welcome to a brand
new very ultra
new day.
Note there are two spaces between new and very on the second line.
On the command line, type:
$ while read confusing ; do
> echo $confusing
> done < bob
< expect some output>
Did the double space on the second line go away? It went away for me and
I've duplicated this on 2.6 and 2.5.1. Anyone know why this is happening?
The solution:
Put double quotes around $confusing. The echo statement was treating each
word as a parameter and thus nuked the extra space. Double quotes protect
the spacing. Of course, we all knew that because we're masters of the basic
unix shells, right?
Thanks to all the extra pairs of eyes, I knew it had to be simple, but I
kept looking and could not see... "Every now and then go away, have a
little relaxation, for when you come back to your work your judgment will
be surer. Go some distance away because then the work appears smaller and
more of it can be taken in at a glance and a lack of harmony and proportion
is more readily seen." - Leonardo Da Vinci
Cheers,
Scott G. Link
Sprint Enterpise Network Services
Alpha Page: 800-724-3508, PIN 382-5992
Numeric Page: 800-724-3329, PIN 382-5992
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:08 CDT