交互双引号较长变量 

#!/bin/bash
RemoteUser=xuesong12
Ip=192.168.1.2
RemotePasswd=xuesong
Cmd="/bin/echo "$PubKey" > "$RemoteKey"/authorized_keys"

/usr/bin/expect -c "
set timeout 10
spawn ssh -o StrictHostKeyChecking=no $RemoteUser@$Ip {$Cmd};
expect {
    password: {
        send_user RemotePasswd\n
        send ${RemotePasswd}\r;
        interact;
    }
    eof {
        send_user eof\n
    }
}
"

 

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2021-11-15
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-10-23
相关资源
相似解决方案