[foxboro] NutCracker Shell (WinXP, V8.3) and the local/global variable problem

  • From: "Weiss, Andreas" <Andreas.Weiss@xxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Thu, 3 Jan 2008 04:27:45 -0600

Hi,

which ways exists to redirect the value of (local) variable in while
loop to a global variable?

#!/bin/ksh
VAR=3D1 # global variable

echo "word1 word2" | tr " " "\n" | while read NAME
do
 set -a
 echo $NAME
 VAR=3D2        # this seems to be a local variable within the while loop
done

echo $VAR       # this prints out a "1" instead of a "2"
#EOF

Regards,
Andreas
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts:

  • » [foxboro] NutCracker Shell (WinXP, V8.3) and the local/global variable problem