[gnu.bash.bug] exiting from functions

robi@attila.esa.oz.au (RoBeRt KaRp) (09/28/89)

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.

Also, using bash-1.03 with the vi diffs that came accross
the other week, on an xterm, I have problems with the
command line editing. 
	1) it doesn't know where the beginning of the
	   line is.
	2) I have CTRL chars embedded in my PS1 to reverse
	   video it on the xterm, & this confuses bash.


		- Robi
 --
 Robert Karp :- robi@attila.esa.oz.AU -:               // /////
 {uunet,mcvax,ukc,nttlab}!munnari!attila.esa.oz!robi  // /////
 Snail: 15-17 Paraween Street,Cremorne, NSW 2090  \\ XX\XXX//
 Tel  : (+61) (02) 953 9488                        \X/\XXXX/

bfox@aurel.cns.caltech.edu (Brian Fox) (09/28/89)

   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".