ASIC/FPGA  Design and Verification Out Source Services 
                            
                            This page shows how to change the default bash 
                            internal field space separator.
                            
                            
- 
I needed to start a script with a single parameter. The parameter is stored in 
a file. Each line in the input file, is a single parameter.
 
- 
The file looks like this:
  
-rw-r--r-- 1 pini pini 5186 May 23 20:57 tlc_tb.vhd 
-rw-r--r-- 1 pini pini 3001 May 23 20:57 tlc.vhd 
-rw-r--r-- 1 pini pini   22 May 23 21:32 a.do 
-rw-r--r-- 1 pini pini  670 May 23 21:32 a.vcd 
-rw-r--r-- 1 pini pini  208 May 23 21:33 a.sav 
-rw-r--r-- 1 pini pini 1276 May 23 21:34 simili.lst 
-rw-r--r-- 1 pini pini  142 May 23 21:34 readme.txt 
  
- 
To my surprise, when using for f loop, it invoked the script with each 
word, separated by spaces, in every line. Since I wanted each line to be a 
single parameter, to the script, I needed to change the default 
IFS of bash.
 
- 
This can be done by:
  
#change the default.  
OIFS="$IFS" 
IFS=$'\n'
  
for f in `cat 1`; do echo "$f"; done
  
#returns to default 
IFS="$OIFS" 
  
                             
                           |