Path: 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.035856.16917@usenet.ins.cwru.edu> Date: 21 Dec 89 03:58:56 GMT References: <8912201910.AA16864@.reed.bitnet> <1989Dec21.013833.6811@usenet.ins.cwru.edu> Reply-To: chet@po.CWRU.Edu () Distribution: gnu Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA) Lines: 49 In article <1989Dec21.013833.6811@usenet.ins.cwru.edu> I wrote: [Stupidity. Mind-boggling stupidity. Cursed be NNTP and fast article propogation. Gawd, it's embarassing] I have fixed the bug, and I will send the fix to Brian. Here's what I get now: usenet$ type rv rv is a function rv () { [ $# = 0 ]&& { local line=empty\?\?\?; read line|| return; echo Read: "$line" 2>&1 ; rv; echo "$line"; return; }; local f=$1; shift; [ $# = 0 ]|| rv $*; rv <$f ; } usenet$ rv ~/foo Read: 1 Read: 2 Read: 3 Read: 4 Read: 5 5 4 3 2 1 It required changing a single line of code. Funny how this one hasn't hit before; *all* instances of functions executing `return' have always had this bug. Chet Ramey -- Chet Ramey Network Services Group "Where's my froggie?" Case Western Reserve University chet@ins.CWRU.Edu