Menu script at SSH2

2007-12-24 22:17:00

Dear,

I want to write a menu at SSH2 that will execute after user login.

My menu script listed as below: [ filename: /etc/sshrc ]

#!/bin/sh
/bin/echo "Welcome!
Your choices are:

1 See today's date
2 See who's logged in
3 See current processes
4 Quit"

/bin/echo "Your choice: \c"
read ans
while [ "$ans" != "q" ]
do
case "$ans" in
1)
/bin/date
;;
2)
/bin/who
;;
3)
/usr/ucb/w
;;
q)
/bin/echo "Goodbye"
exit 0
;;
*)
/bin/echo "Invalid choice '$ans' : please try again"
;;
esac
/bin/echo "Your choice: \c"
read ans
done
exit 0

I can execute by command run but when login use ssh2 client, no input
prompt and continuous loop. What can I do to solve?

Thank you so much.

Theo
Technican
PolyU Hong Kong

Comments

Got something to say?

You must be logged in to post a comment.