Article View: gnu.bash.bug
Article #646exiting from functions
From: Brian Fox
Date: Thu, 28 Sep 1989 15:47
Date: Thu, 28 Sep 1989 15:47
22 lines
933 bytes
933 bytes
From: munnari!attila.esa.oz.au!robi@uunet.uu.net (RoBeRt KaRp)
Date: Thu, 28 Sep 89 15:52:46 W
OK, so it's not a bug, but I see a handy feature to be
added later here.
If I have a function:
foo()
{
if [ -d $whatever ]
then
cd $whatever
else
exit
}
This will exit from the shell, not the function only. How can
I exit from just the function.
Use "return".
Technical Details
Message-ID:
<8909281547.AA02233@aurel.cns.caltech.edu.>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!boulder!ncar!gatech!tut.cis.ohio-state.edu!aurel.cns.caltech.edu!bfoxReferences:
<8909280811.279@munnari.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!boulder!ncar!gatech!tut.cis.ohio-state.edu!aurel.cns.caltech.edu!bfox From: bfox@aurel.cns.caltech.edu (Brian Fox) Newsgroups: gnu.bash.bug Subject: exiting from functions Message-ID: <8909281547.AA02233@aurel.cns.caltech.edu.> Date: 28 Sep 89 15:47:55 GMT References: <8909280811.279@munnari.oz.au> Sender: daemon@tut.cis.ohio-state.edu Reply-To: bfox@aurel.cns.caltech.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 22