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