Use of GOTO statement in scripts

Hey Guys.. I just want to know how to use Goto statement in shell scripts.
I know the basic use of statement.

Goto Label

The above statement will search for some label which must be defined in the script itself as:

label:

I tried these combinations but I didn't work out for me and I'm looking for an exact solution.

By using these statements i'm getting error like:

./goto[5]: goto: not found
./goto[9]: label: : not found

Can anyone tell me the solution??

You never mentioned which shell you are using. Seeing the error, it seems that you might be using ksh or sh. The man pages of ksh and sh dont mention anything about the goto construct.

csh has the goto construct. See the man pages for more details.

goto, as far as I know is not supported by ksh.
and besides who-ever supports it generally recommend not to use it :), so y do you want to use it. instead create functions in k-shell

function fn {
#write fn here,
#echo returnval
}

## call as below
ret_val=`fn`
# check your return value
if [ $ret_val -eq "something" ]
....
...
..

Thanks Pal ... I tried to implement that in ksh... is there any method other than using function to implement the same in k-shell?
i'll try functions for sure but it would be of great help if there is any alternative to that.

If you can post your requirments in details, some one can help you based on that.. or even your script

All i want to do is to ask user if he wants to continue with another number or want to exit instead of "breaking" from case.

Then u can just usew a "while loop" na.. by accepting the choice from user to continue or not..

while [ $CHOICE -nq N ]
do
....
....
your code
....
....
echo "Do you want to continue Y/N?
read CHOICE
done

I think u can satisfy ur requirements with this

I use this function all the while in most of my scripts on k-shell

## Function to handle a y/n reply, y continues, n exits
function cont_yn {
trap "handle_intr" 2 ## trap ctrl-c
dispMsg ${mesg} ##mesg is always a prompt of type Y/N, set b4 call to cont_yn
read yn
if [ "${yn}" != "Y" -a "${yn}" != "y" ]
then
echo "You chose to exit"
exit -1
fi
unset yn
}

## To make echo compatible on Linux and UX
function dispMsg {
UNAME=`uname | awk -F "-" '{print $NF}'`
if [ "$UNAME" = "UX" ]
then
echo "$@\c"
else
echo -ne "$@ "
fi
}