Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!VLSI.CALTECH.EDU!drazen From: drazen@VLSI.CALTECH.EDU (Drazen Borkovic) Newsgroups: gnu.bash.bug Subject: return values of the function and pipe Message-ID: <8907111627.AA08421@vlsi.caltech.edu> Date: 11 Jul 89 16:27:22 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 41 There are 2 problems: 1. Return from a function doesn't work correctly. Value returned from the function is not correct. 2. Value returned by the pipe is not correct. This was bash version 1.02. ========================================================= Script started on Tue Jul 11 09:17:54 1989 > type pushd pushd is a function pushd () { local st ; builtin pushd $1 ; st=$? ; stripe ; return $st } > pushd JUNK.DIR ; echo $? JUNK.DIR: No such file or directory can only `return' from a function > pushd JUNK.DIR JUNK.DIR: No such file or directory can only `return' from a function > echo $? 0 > pushd c ; echo $? ~/c ~ can only `return' from a function > > > cd .. > grep JUNK Maxa ; echo $? 1 > cat Maxa | grep JUNK ; echo $? 0 > > > exit script done on Tue Jul 11 09:19:20 1989 ========================================================= Drazen Borkovic CS dept, Caltech 256-80, Pasadena CA 91125 drazen@vlsi.caltech.edu