|
发表于 2011-6-3 12:01:06
|
显示全部楼层
用expect,不进interact
a snippet of code may like this
- #!/bin/bash
- local-commands
- expect << EOF
- spawn ssh $USR@$HOST -p$PORT
- expect "*assword:"
- send "11111111\n"
- expect "*bash-3.2#"
- send "touch helloWorld\n"
- sleep 1
- EOF
- local-commands
复制代码 |
|