The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: exec command
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-20-2004
g_s_r_c g_s_r_c is offline
Registered User
 

Join Date: Aug 2003
Location: india
Posts: 12
exec command

hai
i want know the difference between two shell scripts those are

1)
a=2004
echo $a #output------2004
exec < inputfile
while read line
do
echo $a #output-------2004
a=2005
echo $line
echo $a #output -------2005
done
echo $a #output------2005

2)
a=2004
echo $a #output------ 2004
while read line
do
echo $a #output------2004
a=2005
echo $line
echo $a #output-----2005
done < inputfile
echo $a #output------2004


I am produceing output in coresponding row please observe it and tell me why the difference is????????



mailny Observe the difference between last line echo $a output
__________________
GsrC
Forum Sponsor