exit shell script from function

Hi all,

I have tried to put a exit 0 statement within a function I have created in the shell script but it doesn't seem to exit out of the script? Can someone tell me why? And is there any other way to exit out of the script from within a function?

Thanks!

Works for me.

$ cat funtest
#! /usr/bin/ksh

one()
{
        echo in one
        exit 0
}

function two
{
        echo in two
        exit 0
}

echo at start
if [[ $1 = one ]] ; then
        one
        echo back from one
else
        two
        echo back from two
fi
exit 0
$ ./funtest one
at start
in one
$ ./funtest two
at start
in two
$