>Ive got a script with the following line:
>echo GREP_DATA is $GREP_DATA
>unfortunately though if i enter ...
>the script displays ...
>GREP_DATA is NC 100
>The problem is that it is not including the extra spaces between the NC
>and the 100. How does one do this?
I am afraid that you show a misunderstanding of how two things work. Consider
first what output you would expect from
echo NC 100
As the shell uses whitespace to delimit arguements, but does not care if there
is more than one space, you would get
So if you wish to preserve the whitespace, you need to put the variable inside
double quotes, i.e. echo "$GREP_DATA" or echo "NC 100".
The other, more subtle point, refers to the way that read works. It will
normally strip any initial characters specified in $IFS, so the correct
script would be (assuming that you don't have a modern shell with 'read -r')
IFS='' read GREP_DATA
echo "GREP_DATA is $ $GREP_DATA"
Of course ksh is a modern shell, so you should modify the command.
Quote:>please answer me in email as i dont read newsgroups much. thanks,
Don't you feel it is a little rude to ask questions but not wait around for