Phi*_*Phi 3 bash shell command expect spawn
我尝试运行.sh文件时出错
line 2: spawn: command not found ": no such file or directory bash.sh: line 3: expect: command not found bash.sh: line 4: send: command not found
#!/usr/bin/expect -f
spawn sftp -o IdentityFile=MyFile.ppk 500200243@XXX.XXX.XXX.XXX
expect "XXX.XXX.XXX.XXX.gatewayEnter passphrase for key 'MyFile.ppk.ppk':"
send "myPassword"
Run Code Online (Sandbox Code Playgroud)
知道为什么会这样吗?
mv bash.sh sftp.expbash bash.sh或那样启动它sh bash.sh.做这个:
chmod a+x sftp.exp./sftp.exp或/path/to/sftp.exp将其移动到$ PATH中的目录并使用它启动它sftp.expsend "myPassword"必须"击中回车"之后:send "myPassword\r"exp_internal 1到顶部.祝你好运,并回来再提问.
| 归档时间: |
|
| 查看次数: |
28143 次 |
| 最近记录: |