Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 无法从bash运行expect脚本_Linux_Bash_Expect - Fatal编程技术网

Linux 无法从bash运行expect脚本

Linux 无法从bash运行expect脚本,linux,bash,expect,Linux,Bash,Expect,我试图从bash调用expect脚本,但出现以下错误: + cd /usr/local/sbin/myscripts + exec transfer_single_cert.expct jw.jwebster ./resend_keys.sh: line 131: exec: transfer_single_cert.expct: not found 这就是狂欢节: #!/bin/bash ...other code cd /usr/local/sbin/myscripts exec tra

我试图从bash调用expect脚本,但出现以下错误:

+ cd /usr/local/sbin/myscripts
+ exec transfer_single_cert.expct jw.jwebster
./resend_keys.sh: line 131: exec: transfer_single_cert.expct: not found
这就是狂欢节:

#!/bin/bash

...other code
cd /usr/local/sbin/myscripts
exec transfer_single_cert.expct $usern
你知道为什么会出现上述错误吗? 文件名是正确的

我也试过了

exec /usr/bin/bash /usr/local/sbin/myscripts/transfer_single_cert.expct $usern
./transfer_single_cert.expct $usern

我猜答案是:默认情况下,当前目录不在搜索路径中,这就是为什么找不到
transfer\u single\u cert.expct

因此,调用
transfer\u single\u cert.expct
作为
/transfer\u single\u cert.expct
(并确保它具有可执行位(
chmod+x transfer\u single\u cert.expct
),并且expect脚本的第一行具有
expect
的正确位置。
或者只使用
expect-transfer\u-single\u-cert.expct

我不太明白,那么
expect-transfer\u-single\u-cert.expct
好吧,expect文件需要用expect调用。