Saturday, 18 February 2017

linux - reading cat file passing to command not working properly

I have a file containing a list of process is input1 file



proc1
proc2 b
proc3 a



I use the following command to read the file and pass on the content of the file to a variable and then do something



for in in cat `input1`;do 
echo $i
done


It works fine for entries like proc1. But the problem is that it assigns only the proc2 to the variable $i and the also assign b to to $i etc etc .. How can I pass the entire proc2 b to variable $i with the space in between ????




Thanks

No comments:

Post a Comment