Shell Scripting Question
(sorry if this got send to the list twice)
Hi,
I have a file which as a list of varions itmes (example below)
# /usr/food/fruits.txt
banana medium yellow
apple small red
watermelon big green
plum small red
etc etc etc ...
when I create the following loop ...
for $fruit in `cat /usr/food/fruits.txt` &&
do echo $fruit
some code with $fruit &&
some more code with $fruit &&
done
it prints the list, but with each word on a seperate line (as followed)
banana
medium
yellow
apple
etc etc etc ...
my question is, how do I get it to print the list with each line as the
variable $fruit, as opposed to $fruit being each word.
Thanks it advanced for any help :^)
Sunny Dubey
Reply to: