Thanks to the many suggestions I got the menu program working. It times out right and even ctrl-c logs the user out. Now the new problem. From the main menu We call other scripts then return to the main menu. The problem is if we type a wrong option we get invalid option but then if we ctrl-c we drop to a prompt. If we go to a option and it returns to the main menu it doesn't timeout and ctrl-c drops to a prompt. Ideas??? here is the main menu:
# Name: helpmenu
clear
trap 'print "Problem with Help Desk menu"; exec kill -9 $PPID' HUP INT QUIT STOP
TIMEOUT=120
while
print " Helpdesk Menu Options"
print " 1) Add users"
print " 2) Change password"
print " 3) Check printer status"
print " 4) Delete printer jobs "
print " 5) Reset printer "
print " 6) Show users on the system"
print " 7) Show an account"
print " 8) Clean up IP address"
print " 9) Logout "
print
(sleep $TIMEOUT; kill -15 $$ >/dev/null 2>&1) &
do read SEL?" Option: "; RC=$?
kill -9 $! >/dev/null 2>&1
case "$SEL" in
1) . set_accounts ;;
2) . newpass ;;
3) . checkprint ;;
4) . deletejob ;;
5) . reset_queue ;;
6) . showusers ;;
7) . show_account ;;
8) . netfix ;;
9) return ;;
*) print
print "Invalid Option ${SEL}, please try again!" ;;
esac
done
Here is one of the sub menus scripts called showusers:
# Name: Showusers
#
trap 'print "Problem with Showusers program "; return' HUP INT QUIT STOP
node=$(hostname -s)
print " "
print " Current users on " $node
print " "
who -uH
print " "
print " "
return
# Name: helpmenu
clear
trap 'print "Problem with Help Desk menu"; exec kill -9 $PPID' HUP INT QUIT STOP
TIMEOUT=120
while
print " Helpdesk Menu Options"
print " 1) Add users"
print " 2) Change password"
print " 3) Check printer status"
print " 4) Delete printer jobs "
print " 5) Reset printer "
print " 6) Show users on the system"
print " 7) Show an account"
print " 8) Clean up IP address"
print " 9) Logout "
(sleep $TIMEOUT; kill -15 $$ >/dev/null 2>&1) &
do read SEL?" Option: "; RC=$?
kill -9 $! >/dev/null 2>&1
case "$SEL" in
1) . set_accounts ;;
2) . newpass ;;
3) . checkprint ;;
4) . deletejob ;;
5) . reset_queue ;;
6) . showusers ;;
7) . show_account ;;
8) . netfix ;;
9) return ;;
print "Invalid Option ${SEL}, please try again!" ;;
esac
done
Here is one of the sub menus scripts called showusers:
# Name: Showusers
#
trap 'print "Problem with Showusers program "; return' HUP INT QUIT STOP
node=$(hostname -s)
print " "
print " Current users on " $node
print " "
who -uH
print " "
print " "
return