shell脚本执行时报"bad interpreter: Text file busy"的解决方法

Posted ybluo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell脚本执行时报"bad interpreter: Text file busy"的解决方法相关的知识,希望对你有一定的参考价值。

1)问题现象:

在ubuntu下执行以下脚本( while_count),报错:

 -bash: ./while_count: /bin/bash: bad interpreter: Text file busy

 

2)问题原因:

 This happens because the script file is open for writing, possibly by a rogue process which has not terminated.

3)解决办法:

Solution: Check what process is still accessing the file, and terminate it.

Run lsof (list open files command) on the script name:

lsof | grep while-count
cat 17653 me   1w REG 8,1 148 181517 /home/me/test/while-count

kill -9 17653

Now try running the script again. It works now.


以上是关于shell脚本执行时报"bad interpreter: Text file busy"的解决方法的主要内容,如果未能解决你的问题,请参考以下文章

linux shell脚本执行错误:bad substitution

LoadRunner跑脚本时报错

执行shell脚本时提示bad interpreter:No such file or directory的解决办法

执行shell脚本错误‘.sh file: /bin/bash^M: bad interpreter’

shell脚本报错:-bash:/bin/sh^M: bad interpreter:

Shell 脚本执行提示:/bin/bash^M:bad interpreter:No such file or directory