With all respect, a goto statement is for those who cannot program. It is a "dirty" way to jump from 1 place in the code to another.
As already mentioned, a goto statement doesnt exist in a Korn Shell.
Instead you could define 2 functions.
#! /bin/ksh
start()
{
echo "start"
}
stop()
{
echo "stop"
}
t=`ps -ef|grep t.sh`
if [ $? -eq 0 ]
then
start
else
stop
fi
By putting "" around 1 letter of the search pattern in the grep command there is no more need for the "grep -v grep" command.
The "grep -v grep" was wrong in this scenario anyway.
Because when you check for the return code "$?", you actually check the return code of the command "grep -v grep" and not of the command "grep ti.sh".
With some shells you'll get an error with the above operation (closing fd1),
so redirecting fd1 to /dev/null will be more portable,
and, of course, with GNU grep you can use the "q" option.