1、apt-get install expect

2、编写shell脚本test.sh

#!/usr/bin/expect -f
#!/bin/sh
set password 1
spawn scp root@192.168.1.93:/opt/ybs/bin/YSNY.pyc /opt/ybs/bin/
set timeout 10;
expect {
        yes/no {send yes\n;exp_continue};
        password: {send $password\n};
}
set timeout 10;
send exit\n;
expect eof;

相关文章:

  • 2021-10-27
  • 2021-11-07
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
相关资源
相似解决方案