- 在任意地方编辑文本,比如 ~/.ssh/wx
#!/usr/bin/expect -f
set port 2121
set user root
set host 172.16.10.71
set password mima123456
set timeout -1
spawn ssh -p$port $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
- command+,打开设置
#!/usr/bin/expect -f
set port 2121
set user root
set host 172.16.10.71
set password mima123456
set timeout -1
spawn ssh -p$port $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof