系统相关
首页 > 系统相关> > call expect script content in bash shell

call expect script content in bash shell

作者:互联网

expect <<EOF
set timeout 10
spawn ssh $user@$ip
expect {
"yes/no" { send "yes\n";exp_continue }
"password" { send "$password\n" }
}
expect "]#" { send "useradd hehe\n" }
expect "]#" { send "echo rrr|passwd --stdin hehe\n" }
expect "]#" { send "exit\n" } expect eof
EOF

标签:spawn,shell,script,send,content,expect,yes,password,hehe
来源: https://www.cnblogs.com/beilei123/p/15533272.html