为了写sftp 服务器间文件shell 脚本 expect报错: spawn: command not found
通过Google查找资料,我的expect安装成功的,which expect 查看一下安装路径,发现安装正常无问题。
然后./excute.sh 执行shell 脚本依然报如下错误。
line 3: spawn: command not found
couldn't read file "password:": no such file or directory
line 5: send: command not found
line 6: interact: command not found
大家不要慌,csdn上基本都不行,还是要靠自己去Google。
最后一行命令 expect -f ./excute.sh
直接解决问题。这里附我参考的地址,
https://www.e-learn.cn/content/wangluowenzhang/752290
It all depends on how you invoke the command. Like ray said, even if you specify the environment with a bang at the top, you still have to run it using expect -f.