The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 10-06-2008
er_aparna er_aparna is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 52
getting spaces while reading file from for loop

Hi ,

I am getting similar problem,
but in my case i am fetching variable value from a file , and then echo the value, but its considering spaces in the file. for exmp:

file - temp1 has contents in quotes
"group name used to communicate with x service"
"group name used to communicate with y service"

i used for loop :
for var in `cat "temp1"`
do
echo "DESC=$var;"
done


the desired output is
DESC="group name used to communicate with x service";
DESC="group name used to communicate with y service";

however, the output coming is
DESC="group";
DESC="name";

its reading spaces also...

Pls suggest...............

Thanks in advance
Aparna