linux - Bash command to exit from TL1 terminal -
i have bash script telnets system's tl1 terminal , executes command how exit out of tl1 terminal?
i've tried quit , exit , doesn't work. normally, press ctrl+c if had logged in manually tl1 term , work; how automate process?
#!/bin/bash ( echo "act-user::root:d::root;" echo "^c" echo "quit" echo "exit" ) | telnet 192.168.1.1 echo "done" exit
expect, tool script interactive programs that's part of linux distributions may help. fiddling required, goes this:
#!/usr/bin/expect -f spawn telnet 192.168.1.1 send "act-user::root:d::root;\r" send \003
which start telnet host , send command string followed control-c. expect has many more possibilities (especially fact can react other side replies, possibility limit script runtime, etc), , there literally hundreds of references on internet, should started.
Comments
Post a Comment