~1 min read

Categories

Sometimes I need to scp files from remote server, but I hate to input the (fixed) password over and over again. Here is a solution using “expect”

#!/usr/bin/expect
set name [linde $argv 0] # read name from argument
spawn scp id@server1:/data/location /data/destination # scp
expect "*password:*" {send "your password"}
interact