4 puts stderr "Usage: sshauser \[ --retry \] port user \[ command ... \]"
14 if { [lindex $argv $arg] == "--retry" } {
16 set arg [expr $arg + 1]
18 set offset [lindex $argv $arg]
19 set arg [expr $arg + 1]
20 set username [lindex $argv $arg]
21 set arg [expr $arg + 1]
22 set command [lrange $argv $arg $argc]
27 # trap SIGWINCH and pass to spawned process
30 set cols [stty columns]
31 stty rows $rows columns $cols < $spawn_out(slave,name)
37 spawn ssh -o NoHostAuthenticationForLocalhost=yes -p $offset $username@localhost
39 expect "Are you sure you want to continue connecting (yes/no)" {
44 if { $argc > 2 } { send "$command\r" }
48 if { $argc > 2 } { send "$command\r" }
51 } "ssh: connect to host localhost port $offset: Connection refused" {
55 send_user "conection lost... retrying in 5 seconds.\n"
59 } "ssh_exchange_identification: read: Connection reset by peer" {
63 send_user "Device rebooting waiting for 15 seconds.\n"