[Top][All Lists]

[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 (X11/20080213)


$ 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

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

reply via email to

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