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

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

[oracle@DB-Server bin]$ ./killSession.sh 
    -bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy

此时只需要在#!/bin/bash,加一空格#! /bin/bash即可解决问题。

另外一种情况: 当有其它进程访问这个文件,可以通过lsof | grep  killSession.sh来查看是否有其它进程正在访问该文件。

此时可以用kill命令杀掉其它进程。解决上面这个问题。

时间: 2024-08-01 09:40:38

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

求救!求救ssh2 远程Shell脚本执行工具的问题

问题描述 最近在用ssh2远程Shell脚本执行工具写了一个代码测试执行普通的命令都可以比如"ls"啦什么的都可以但是执行动态的就不可以比如"top"也没有错误只是返回的是"".求大家帮忙呀!下面是代码main是测试用的是root的权限packagecom.syxp.sjyw.util;importjava.io.IOException;importjava.io.InputStream;importjava.nio.charset.Charse

使用Python脚本实现批量网站存活检测遇到问题及解决方法_python

做渗透测试的时候,有个比较大的项目,里面有几百个网站,这样你必须首先确定哪些网站是正常,哪些网站是不正常的.所以自己就编了一个小脚本,为以后方便使用. 具体实现的代码如下: #!/usr/bin/python # -*- coding: UTF-8 -*- ''' @Author:joy_nick @博客:http://byd.dropsec.xyz/ ''' import requests import sys f = open('url.txt', 'r') url = f.readline

Linux中提示No such file or directory解决方法

  问题描述 解决方法 分析原因,可能因为我平台迁移碰到权限问题我们来进行权限转换 1)在Windows下转换: 利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行.转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可. 2)方法 用vim打开该sh文件,输入: [plain] :set ff 回车,显示fileformat=dos,重新设置下文件格式: [plain] :set ff=uni

android建立项目时失败:Android Manifest.xml file missing的解决方法

安卓(android)建立项目时失败,出现AndroidManifest.xml file missing几种解决方法?(总结中) Eclipse新建项目,遇到这样的问题,注意如下: 1.文件名最好不要用中文. 2.目录也不要用中文. 3.这个不会出错,但出于程序编写习惯,第一个字母最好为大写. 查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

登陆vsftp创建文件553 Could not create file错误的解决方法

风信网(ithov.com)原创文章,今天测试Centos登陆vsftp创建文件553 Could not create file报错信息如下: 响应:&http://www.aliyun.com/zixun/aggregation/37954.html">nbsp;227 Entering Passive Mode (192,168,1,6,251,12). 命令: LIST 响应: 150 Here comes the directory listing. 响应: 226 Di

Eclipse报错"No embedded stylesheet instruction for file"的解决方法

原文:http://hi.baidu.com/ini_always/blog/item/3c4b7a531ca15e15377abe7e.html 前一阵子去实习,后来也没什么好写的,所以很久没写东西了.今天刚好遇到个错误,而且是可写的,所以拿来和大家一起分享. 先看一下控制台输出的内容,如下: 15:34:18,286 INFO [main] Main - javax.xml.transform.TransformerFactory=null 15:34:18,288 INFO [main]

Cannot open include file: jni.h: No such file or directory解决方法

在此运行Visual Studio 2008 项目时出现 #include <stdio.h> #include <jni.h> int main() { printf("Hello World"); } But when I try to build, I get the following error - 1>c:testtest.cpp(2) : fatal error C1083: Cannot open include file: 'jni.h'

Shell脚本Ping监控主机是否存活并发邮件报警(三种方法)

#前提已经可以通过mail或mutt客户端发邮件 1.先安装sendmail来发邮件 1 2 3   # yum -y install sendmail   # /etc/init.d/sendmail start   # chkconfig sendmail on 2.再安装邮件客户端 1    # yum -y install mutt   2.1 为了更好在邮件中显示,设置mutt客户端发送信息 1 2 3 4 5 6 7   # vim /etc/Muttrc   set charset

Shell脚本中获取本机ip地址的3个方法_linux shell

方法一: 复制代码 代码如下: /sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" or /sbin/ifconfig|sed -n '/inet addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/p' 方法二: 复制代码 代码如下: local_host="`hostname --fqdn`" local_i