文件状态测试
-b filename : 当filename 存在并且是块文件时返回真(返回0)
-c filename : 当filename 存在并且是字符文件时返回真
-d pathname : 当pathname 存在并且是一个目录时返回真
-e pathname : 当由pathname 指定的文件或目录存在时返回真
-f filename : 当filename 存在并且
转载
精选
2012-06-15 14:33:20
706阅读
1、脚本之间传递参数 "1.sh"的脚本,接受参数。如下,如果有一个参数则赋值个sourceFile这个变量,否则用默认值。 Shell代码 #!/bin/bash LANG=en_US.UTF-8 #get parameters source
转载
精选
2015-06-08 19:39:34
978阅读
1、脚本之间传递参数 “1.sh”的脚本,接受参数。如下,如果有一个参数则赋值个sourceFile这个变量,否则用默认值。Shell代码#!/bin/bashLANG=en_US.UTF-8#get parameterssourceFile=”/data/log/abc”if [ $# == 1 ]then sourceFil
转载
精选
2016-03-24 09:58:00
592阅读
常用的Shell脚本
原创
2020-11-09 18:58:43
380阅读
平时我们adb shell进入#:这个模式下操作,shell如何去模拟实际操作?echo.>%path%\testFile\test_Prepare.txt 暂时不知道啥意思echo sync>%path%\testFile\test_Prepare.txt
echo exit>>%path%\testFile\test_Prepare.txt上面那两
原创
2024-05-18 14:56:21
98阅读
1、Grep本目录中以数字命名的文件和以A或者B开头命名的文件
ls |grep -E '^[0-9]{1,}$|^A|^B'
2、有一个a.txt文件,把里面所有字母都转换成大写
sed -i 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' a.txt 3、Sed打印出文中前10行、第一行、最后一行,把文中所有的abc字
原创
2012-05-27 22:46:18
2098阅读
#!/bin/bash # 检查192.168.1.1—192.168.1.254 主机是否存活for ip in 192.168.1.{1..254}; do if ping -c 1 $ip >/dev/null; then echo "$ip OK." else &n
原创
2017-06-22 10:43:40
668阅读
点赞
1.显示消耗内存/CPU最多的10个进程……
转载
2011-10-08 15:47:57
510阅读
获取IP地址和子网掩码 ifconfig eth0 | grep "inet addr" | awk -F "[ : ]+" '{print $4 "\\" $8}'
原创
2014-07-10 09:41:59
564阅读
常有shell脚本2011年4月7日woyoo3,341 浏览数发表评论阅读评论转载:http://hdxiong.iteye.com/blog/9490631、脚本之间传递参数 “1.sh”的脚本,接受参数。如下,如果有一个参数则赋值个sourceFile这个变量,否则用默认值。#!/bin/bash
LANG=en_US.UTF-8
#get parameters
sour
转载
精选
2016-05-23 15:28:43
850阅读
点赞
【脚本1】打印形状打印等腰三角形、直角三角形、倒直角
转载
2022-09-26 22:21:27
1297阅读
一、文件操作类查找特定文件并输出路径:#!/bin/bash
find /path/to/search -name "target_file.txt"批量重命名文件:#!/bin/bash
for file in *.old_extension; do
mv "$file" "${file%.old_extension}.new_extension"
done统计文件夹下文件数量:#!/
1.按照内容分组
[root@localhost ~]# cat qq.tel
12334:13580226308
12334:13580126308
123334:13580226308
12099879:13810226308
12334:13810226306
12334:13510026308
12099879:13513263085
12099879:13760789
原创
2013-03-31 14:44:02
620阅读
前言 网上收集整理,感谢老男孩及各路大神,经常看他们的博客和视频,脚本绝对是自己纯手打,有什么不足之处,还请各位大神指点。若觉得有侵权地方,请及时联系本人,本人立即删除!! 再次感谢老男孩,虽然没报您的学习班,但是看过好多您出的视频和您的博客。人要懂得感恩,尽管不是您的学生!部分题目链接:http://oldboy.blog.51cto.com/2561410/163287
原创
2015-12-11 11:20:49
922阅读
1、list_sys_status.sh显示系统使用的以下信息:主机名、IP地址、子网掩码、网关、DNS服务器IP地址信息#!/bin/bashIP=`ifconfig eth0 | head -2 | tail -1 | awk '{print $2}' | awk -F":" '{print $2}'`ZW=` ifconfig eth0 | head -2 | tail -1 | awk '
原创
精选
2021-06-02 09:45:08
779阅读
[root@nginx ~]# sh /etc/scripts/process.sh #!/bin/bash FILENAME=`basename $0 .sh` #获取脚本文件名称,不包含.sh后缀 FILEPATH=`dirname $0` echo "PID of this script: $
原创
2024-10-09 14:14:33
19阅读
关闭所有进程ps -ef |grep hello |awk '{print $2}'|xargs kill -9参考博客[1]
原创
2022-08-04 15:32:28
55阅读
批量创建用户名脚本:
1 #########################################################################
2 # File Name: create-user.sh
3 # Author: kingle
4 # Mail: kingle122@vip.qq.com
5 # Created Ti
原创
2022-01-18 11:49:03
118阅读
bash shell反弹脚本 Python shell 反弹脚本 利用方式,保存成back.sh 或者back.py ,通过远程下载执行即可利用! 借鉴: https://jivoi.github.io/2015/07/01/pentest-tips-and-tricks/ http://pente
原创
2022-06-21 22:02:56
1587阅读
常用shell脚本总结一、计算100以内奇偶数的和的几种方法 1)、方法一 {1..100..2}[root@station78 scirtp]# cat 6.sh
#!/bin/sh
evensum=0
for i in {1..100..2}
do
evensum=$[$evensum+$i]
done
echo "1+3+5+...=$evensum"
od
原创
2013-07-19 21:42:47
10000+阅读
点赞
3评论