I want to execute my local script on remote server.
#!/usr/bin/expect -f
set idNhost [lindex $argv 0]
set password [lindex $argv 1]
eval spawn ssh $idNhost \'bash -s\' < a.sh
expect -re "password"
send "$password\r"
interact
But expect interpret each argument as a single commend. So it find script on remote server.
Please help me....
Try like this:
spawn bash -c "ssh $idNhost bash -s < a.sh"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With