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"的解决方法的更多相关文章

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

    在执行一个shell脚本时,遇到了“-bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy”错误提示,如下所示: [or ...

  2. shell脚本:Syntax error: Bad for loop variable错误解决方法(转)

    Linux Mint中写了一个简单的shell脚本,利用for..do..done结构计算1+2+3......+100的值,结果执行"sh -n xxx.sh"检测语法时总是报错 ...

  3. bad interpreter: Text file busy

    刚才运行test_mysql.py文件的时候 报了个这样的错.上网查了下,链接在这里:http://www.cnblogs.com/kerrycode/p/4038934.html 于是我就把第一行的 ...

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

    执行shell脚本时提示bad interpreter:No such file or directory的解决办法 故障现象:在终端直接cd /var正常,在shell脚本中执行则报错.原因是脚本是 ...

  5. windows下建立文件的换行符^M导致linux下的shell脚本执行错误的解决方式

    常常在windows下编辑的文件远程传送到linux下的时候每行末尾都会出现^M.这将导致shell脚本执行错误,主要是由于dos下的编辑器和linux下的编辑器对文件末行的回车符处理不一致导致. 主 ...

  6. 远程shell脚本执行工具类

    /** * 远程shell脚本执行工具类 */public class RemoteShellExecutorUtils { private static final Logger logger = ...

  7. shell脚本执行错误 $'\r':command not found

    shell脚本执行错误 $'\r':command not found Linux下有命令dos2unix 可以用一下命令测试 vi -b filename 我们只要输入dos2unix *.sh就可 ...

  8. 用java代码调用shell脚本执行sqoop将hive表中数据导出到mysql

    1:创建shell脚本 touch sqoop_options.sh chmod 777 sqoop_options.sh 编辑文件  特地将执行map的个数设置为变量  测试 可以java代码传参数 ...

  9. 2.8 补充:shell脚本执行方法

    bash shell 脚本的方法有多种,现在作个小结.假设我们编写好的shell脚本的文件名为hello.sh,文件位置在/data/shell目录中并已有执行权限.   方法一:切换到shell脚本 ...

随机推荐

  1. easyui,文件引用

  2. HTML/overflow的认识

    1.overflow的定义:overflow属性规定当内容溢出元素框时应该做的处理.2.overflow:scorll; 是提供一种滚动的机制.3.关于overflow的其他相关值设置:

  3. [LeetCode&Python] Problem 202. Happy Number

    Write an algorithm to determine if a number is "happy". A happy number is a number defined ...

  4. Java方法 传值方式

    这个问题是面试的时候经常会问到的一道题吧?这次做项目的过程中,其中一个同学因为无用了,导致了一个bug,不过是在提测前啦!本来我想借着这次机会分享一下java方法传参的机制,但是经过几天的学习,了解, ...

  5. linux自启动tomcat

    第一种方式 1.修改脚本文件rc.local:vim /etc/rc.d/rc.local 这个脚本是使用者自定的开机启动程序,可以在里面添加想在系统启动之后执行的脚本或者脚本执行命令 2.添加如下内 ...

  6. SQL-存储过程-010

    什么是存储过程? 可以理解为数据库中的方法,与C#中的方法一样,具有参数和返回值: 存储过程的优点? 提高运行速度:存储过程在创造是进行编译,以后运行存储过程都不需要再进行编译,极大化的提高了数据库的 ...

  7. matplotlib.pyplot展示MNIST图片

    import torch import torch.utils.data as Data import torchvision import torchvision.transforms as tra ...

  8. C++中字符数组与string的相互转换

    字符数组转化成string类型char ch [] = "ABCDEFG";string str(ch);//也可string str = ch;或者char ch [] = &q ...

  9. ubuntu16.04下配置apache2与php

    系统版本:ubuntu16.04 命令均在终端中输入,用浏览器测试 //安装apache2命令 sudo apt install apache2 //测试是否安装成功 浏览器地址栏输入“localho ...

  10. 阻塞I/O、非阻塞I/O和I/O多路复用

    一.阻塞I/O 首先,要从你常用的IO操作谈起,比如read和write,通常IO操作都是阻塞I/O的,也就是说当你调用read时,如果没有数据收到,那么线程或者进程就会被挂起,直到收到数据.阻塞的意 ...