Thursday, October 24, 2013

receive argument on expect shell script

I just wanted to scp easily. I just simply made a expect shell script which receive one argument.
I just excute one script like below

cp.sh file

and copy finished
#!/usr/bin/expect -f

set filename [lindex $argv 0];

spawn scp -v /temp/$filename root@192.168.1.1:/tmp/root/
expect "Enter passphrase"
send "\r"
...

No comments:

Post a Comment