[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable scoping
From: |
Chet Ramey |
Subject: |
Re: Variable scoping |
Date: |
Fri, 25 Jul 2008 11:31:24 -0400 |
User-agent: |
Thunderbird 2.0.0.16 (Macintosh/20080707) |
Dan Stromberg wrote:
Having a shell function's variable changes reflected in its caller really
kinda makes me shudder - in fact, it reminds me of gosub. It seems like
a bug waiting to happen; I'm amazed I haven't been bitten by it yet.
This is as Posix has standardized: all variables are global, and there
is no official mechanism to create function-scope variables without
using a subshell.
(This won't go to comp.unix.shell; I don't use usenet any more.)
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/