expect scp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
auto_scp()
{
	local filepath=$1
	expect -c "
		set timeout 10
 
		spawn scp scp://someone@192.168.12.3:1234//home/someone/$filepath .
 
		expect \"password:\" 
		send \"toodangerous\r\"
 
		interact
	"
}

refer to:
https://blog.csdn.net/f_zyj/article/details/93475830
https://zhuanlan.zhihu.com/p/25164676