![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| global variable not being set | robotball | Shell Programming and Scripting | 5 | 06-10-2008 06:20 AM |
| global variable in awk | anhtt | Shell Programming and Scripting | 1 | 03-16-2008 03:55 PM |
| Problem with global and local variables | qzv2jm | Shell Programming and Scripting | 2 | 03-04-2008 01:18 PM |
| Global Variable in awk... | ZINGARO | Shell Programming and Scripting | 1 | 07-04-2007 01:07 PM |
| Reg. Local vs Global declarations | kms | High Level Programming | 2 | 05-02-2005 09:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Global variable becomes local
I have encountered a very weird behavior of a global variable in Korn Shell in AIX:
A function f1 in my script pipes the output of the function f2 to a program. A variable defined as global using typeset gets its value in f2. That value is not seen in f1. If I remove the pipe ksh recognizes the variable as global. Can anybody explain this? #!/usr/bin/ksh typeset var function f2 { var=1111 } function f1 { typeset lpt=tmp var=alpha f2 | wc $lpt print "after f2 call, \$var is $var" } f1 ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|