🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #1074

Re: Strange behavior with functions

#1074
From: Chet Ramey
Date: Thu, 21 Dec 1989 01:38
26 lines
1540 bytes
In article <8912201910.AA16864@.reed.bitnet> trost%REED.BITNET@MITVMA.MIT.EDU writes:

>bash$ cat rv
>   rv () {
>           [ $# = 0 ] && {
>                   # Call this block A
>                   local line=empty\?\?\?

I seem to have not fixed this completely, or maybe I'm just confused.  I
did fix the longjmp botch problem, but I don't think this line is doing
what everyone thinks it should be doing.  The `local' part works simply
because rv is a function, and you can declare local variables in a function.
The `{' doesn't really begin a new block with a separate context; on the
contrary, it guarantees that the block will be executed in the *current*
shell, with the *current* context.

Anyway, I don't think it should work as written.  This isn't C.  (If everyone
else thinks otherwise, I'm pretty sure I have a fix for it.  But I'm just not
convinced that it ever should have worked.)

Chet Ramey
-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu			
Technical Details
Message-ID: <1989Dec21.013833.6811@usenet.ins.cwru.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
References: <8912201910.AA16864@.reed.bitnet>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!cwns1!chet
From: chet@cwns1.CWRU.EDU (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: Strange behavior with functions
Message-ID: <1989Dec21.013833.6811@usenet.ins.cwru.edu>
Date: 21 Dec 89 01:38:33 GMT
References: <8912201910.AA16864@.reed.bitnet>
Reply-To: chet@po.CWRU.Edu ()
Distribution: gnu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
Lines: 26