Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I make a variable with a space one "word" 1

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
US
Hi

When I do this:


for POOL in `cat pools.txt`

do
echo "$POOL"
done

I get this:

NT
Oracle
Oracle2
Oracle3
System
Files

a cat of pools.txt reveals this:

#cat pools.txt
NT
Oracle
Oracle2
Oracle3
System Files



How do I get ksh to do want I intend, which is treat a variable with a space one "word"?


-John
 
while read POOL
do
echo "$POOL"
done < pools.txt

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Brilliant and timely, PHV. Sorry if this was answered before.

So why is this such, is it because of the IFS variable is not used in the while syntax?

-John
 
No. It's not a while issue but a read one.
In the ksh man page take a look at the read builtin.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top