Cuz you didn't background the job sshd will wait 'til login timout before returning.
In any case I think it would be better to separate the action from the output (configurability, timeout, unknown input), using a little "expect" script could help, or if this is a permanent test, have a look at "Monit". Btw, for the ps thingie you can use "kill -9 $(pgrep telnet)" provided you can only see your users PID's or select by UID if you're running more telnet sessions, and don't forget you can also use $? (or ${#Connection}) for actions based on the output of telnet if the var doesn't hold stuff...
|