1. 程式人生 > >【轉】shell腳本執行時報"bad interpreter: Text file busy"的解決方法

【轉】shell腳本執行時報"bad interpreter: Text file busy"的解決方法

and files hat scrip proc nbsp comm this rep

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"的解決方法