/usr/bin/expect: bad interpreter: No such file or directory

shell 同时被 2 个专栏收录
17 篇文章 0 订阅
5 篇文章 0 订阅

在java中执行expect的文件时,报错如下

java.io.IOException: Cannot run program "/usr/local/tomcat/task/shell/1505978794583.sh": error=2, No such file or directory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at java.lang.Runtime.exec(Runtime.java:450)
        at java.lang.Runtime.exec(Runtime.java:347)
        at com.qihoo.datacenter.olap.common.BasicScriptsTask.run(BasicScriptsTask.java:64)
        at com.qihoo.datacenter.olap.run.HadoopTask.call(HadoopTask.java:36)
        at com.qihoo.datacenter.olap.run.HadoopTask.call(HadoopTask.java:18)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
        at java.lang.ProcessImpl.start(ProcessImpl.java:134)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 12 more

找了很久,以为是文件权限问题,结果最后发现是因为没有安装expect就会报

bash: ./1505978977874.sh: /usr/bin/expect: bad interpreter: No such file or directory
解决方法如下:
1、yum install tcl-devel

2、yum install expect

  • 1
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值