bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

variable scope


From: Antonio Macchi
Subject: variable scope
Date: Fri, 24 Oct 2008 10:50:45 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080213)

$ a=OUTSIDE

$ f1 () { local a=INSIDE; f2; }

$ f2 () { echo "before: $a";
          unset a;
          echo "after: $a"; }


$ f3 () { local a=INSIDE;
          echo "before: $a";
          unset a;
          echo "after: $a"; }


$ f1
before: INSIDE
after: OUTSIDE

$ f3
before: INSIDE
after:


I can unset an 'external-local' variable, and then get his global scope
but I can't do the same with an 'internal-local' one

may be this is not perfectly coherent


(*imho*, local variables should not be seen in other functions...)


thanks for your job
bye




reply via email to

[Prev in Thread] Current Thread [Next in Thread]