同样的脚本内容,不同的名字2种不同的执行结果?
时间:2011-07-06
来源:互联网
[root@localhost ]# cat 2.sh
#!/bin/bash
num=`ps aux|grep tomcat|grep -v grep|wc -l`
echo "$num"
[root@localhost ]# sh 2.sh
3
改名字后的结果,
[root@localhost ]# mv 2.sh check_tomcat.sh
[root@localhost ]# cat check_tomcat.sh
#!/bin/bash
num=`ps aux|grep tomcat|grep -v grep|wc -l`
echo "$num"
[root@localhost ]# sh check_tomcat.sh
6
[root@localhost ]#
不知道bash是不是对脚本名字的长度有限制?
系统版本如下:
[root@localhost ~]# cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m
[root@localhost ~]# echo $BASH_VERSION
3.2.25(1)-release
#!/bin/bash
num=`ps aux|grep tomcat|grep -v grep|wc -l`
echo "$num"
[root@localhost ]# sh 2.sh
3
改名字后的结果,
[root@localhost ]# mv 2.sh check_tomcat.sh
[root@localhost ]# cat check_tomcat.sh
#!/bin/bash
num=`ps aux|grep tomcat|grep -v grep|wc -l`
echo "$num"
[root@localhost ]# sh check_tomcat.sh
6
[root@localhost ]#
不知道bash是不是对脚本名字的长度有限制?
系统版本如下:
[root@localhost ~]# cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m
[root@localhost ~]# echo $BASH_VERSION
3.2.25(1)-release
作者: zhaoke0128 发布时间: 2011-07-06
回复
你的脚本名也有关键字tomcat,所以。。。。。。。
你的脚本名也有关键字tomcat,所以。。。。。。。
作者: wtuter 发布时间: 2011-07-06
回复 zhaoke0128
mv 2.sh check_.sh呢
再试试
mv 2.sh check_.sh呢
再试试
作者: yinyuemi 发布时间: 2011-07-06
回复 wtuter
谢谢,脚本名字没有tomcat关键字,就可以了
谢谢,脚本名字没有tomcat关键字,就可以了
作者: zhaoke0128 发布时间: 2011-07-06
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28