Put the case-esac construct in a while loop.
Code:
[/tmp]$ cat test.ksh
#! /bin/ksh
#
while :
do
case $1 in
"") set -- a ;;
"a") echo "a" ; set -- b ;;
"b") echo "b" ; set -- c ;;
"c") echo "c" ; set -- d ;;
"d") echo "d" ; break ;;
*) echo "Wrong" ; break ;;
esac
done
[/tmp]$ ./test.ksh
a
b
c
d
[/tmp]$ ./test.ksh a
a
b
c
d
[/tmp]$ ./test.ksh c
c
d
[/tmp]$ ./test.ksh d
d
[/tmp]$ ./test.ksh z
Wrong
[/tmp]$ ./test.ksh abcd
Wrong
[/tmp]$