gnu.bash.bug
[Top] [All Lists]

Re: Variable scoping

Subject: Re: Variable scoping
From: Chet Ramey <chet.ramey@xxxxxxxx>
Date: Fri, 25 Jul 2008 11:31:24 -0400
Newsgroups: gnu.bash.bug


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@xxxxxxxx    http://cnswww.cns.cwru.edu/~chet/



<Prev in Thread] Current Thread [Next in Thread>