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

  • From: "dweinbrenner" <dweinbrenner@xxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Thu, 3 Jan 2008 12:22:03 +0100

Hi Andreas,

You can=B4t pass your variable VAR through the pipe of your while =
command.
Try this:

VAR=3D1 # global variable

for NAME in $(echo "word1 word2" | tr " " "\n" )
do =20
 echo $NAME
 VAR=3D2        # this isn=B4t local
done

echo $VAR       # this prints 2


Best Regards,
------------------------
Daniel Weinbrenner
Process Automation and=20
Software Development
=20
Erpicon software development GmbH
Neusser Str. 724- 726
50733 K=F6ln =B7 Germany
Tel: +49 (0)221 97460 - 65
Fax: +49 (0)221 97460 =96 99
e-mail: dweinbrenner@xxxxxxxxxx

Internet: www.erpicon.de
Gesch=E4ftsf=FChrer: Dirk Betzner
Registergericht: K=F6ln HRB 23985
=20
--
Die Information in dieser eMail ist vertraulich und kann dem =
Berufsgeheimnis
unterliegen. Sie ist ausschliesslich fuer den Adressaten bestimmt. =
Jeglicher
Zugriff auf diese eMail durch andere Personen als den Adressaten ist
untersagt. Sollten Sie nicht der fuer diese eMail bestimmte Adressat =
sein,
ist Ihnen jede Veroeffentlichung, Vervielfaeltigung oder Weitergabe wie =
auch
das Ergreifen oder Unterlassen von Massnahmen im Vertrauen auf erlangte
Information untersagt.

The information in this email is confidential and may be legally =
privileged.
It is intended solely for the addressee. Access to this email by anyone =
else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in =
reliance
on it, is prohibited and may be unlawful.
=20
=20
=20

-----Urspr=FCngliche Nachricht-----
Von: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] =
Im
Auftrag von Weiss, Andreas
Gesendet: Thursday, January 03, 2008 11:28 AM
An: foxboro@xxxxxxxxxxxxx
Betreff: [foxboro] NutCracker Shell (WinXP, V8.3) and the local/global
variable problem

Hi,

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

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

echo "word1 word2" | tr " " "\n" | while read NAME
do
 set -a
 echo $NAME
 VAR=3D3D2      # 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
=20
=20
_______________________________________________________________________
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
=20
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe:      =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=20

 
 
_______________________________________________________________________
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] AW: NutCracker Shell (WinXP, V8.3) and the local/global variable problem