The UNIX and Linux Forums  

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 -->
  #2 (permalink)  
Old 11-16-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
The inner loop is a sub-process. Anything changed there has no effect on the parent process. It's the same situation as

X=1
bash -c "X=2"
echo $X

Both of your loops are reading from stdin. Each process only has 1 stdin so your two loops absolutely need to be separate processes.