
Shell
rocksword
这个作者很懒,什么都没留下…
展开
-
shell计算指定日期的后一天日期
shell计算指定日期的后一天日期例如输入:20110228输出:20110301输入:20110830输出:20110831我只知道计算当前日期的后一天,或者几天的日期是date +%Y%m%d --date='1 day' (1标示明天,2是后天,以此类推)#date -d "20110228 1 days" "+%Y%m%d"20110301#转载 2013-07-30 16:55:24 · 1492 阅读 · 0 评论 -
Shell运行Java程序
Java,Shell原创 2013-08-09 12:15:03 · 331 阅读 · 0 评论 -
IFS – Internal Field Separator
It seems like an esoteric concept, but it’s actually very useful.If your input file is “1 apple steve@example.com”, then your script could say:while read qty product customerdo echo "${custom转载 2015-04-01 15:22:20 · 328 阅读 · 0 评论 -
What are the exact differences between awk and cut with grep
The most prominent difference between your two lines would be depending on the input. cut takes a single character in -d as the field delimiter (the default being TAB), and every single occurrence转载 2015-01-24 18:26:04 · 266 阅读 · 0 评论 -
find和xargs使用详解
1.find由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下。即使系统中含有网络文件系统( N F S ),find命令在该文件系统中同样有效,只你具有相应的权限。在运行一个非常消耗资源的find命令时,很多人都倾向于把它放在后台执行,因为遍历一个大的文件系统可能会花费很长的时间(这里是指3 0 G字节以上的文件系统)。find命令的一般形式为:转载 2013-08-11 21:54:19 · 295 阅读 · 0 评论 -
tar命令批量解压方法总结
由于linux的tar命令不支持批量解压,所以很多网友编写了好多支持批量解压的shell命令,收集了一下,供大家分享:第一:for tar in *.tar.gz; do gtar zxvf $tar; done第二:用tar命令批量解压某个文件夹下所有的tar.gz文件ls *.tar.gz | xargs -n1 gtar zxvf第三:find -maxdepth 1转载 2013-08-11 21:54:17 · 288 阅读 · 0 评论 -
Linux man page - nc
Namenc - arbitrary TCP and UDP connections and listensSynopsisnc [-46DdhklnrStUuvzC] [-i interval] [-p source_port] [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol] [转载 2015-02-10 17:12:42 · 308 阅读 · 0 评论 -
shell 按行读取并保存成数组
从ip.txt里读取IP.然后把IP地址赋值到一个数组里.IP文件如下:Address: 220.181.26.163Address: 220.181.26.174Address: 220.181.26.175Address: 220.181.26.176Address: 220.181.19.228Address: 220.181.19.229Addr转载 2015-02-05 14:26:45 · 1825 阅读 · 0 评论 -
Shell脚本分割大文件
#!/bin/bashlinecnt=`wc -l $1 | awk '{print $1}'`n1=1file=1while [ $n1 -lt $linecnt ]; do n2=`expr $n1 + $2` sed -n "${n1}, ${n2}p" $1 > $1_$file n1=`expr $n2 + 1` file=`expr $file原创 2014-12-08 17:11:29 · 398 阅读 · 0 评论 -
The Unix Shell's Humble If
The Unix shell is often overlooked by software developers more familiar with higher level languages. This is unfortunate because the shell can be one of the most important parts of a developer’s too转载 2014-05-22 20:01:08 · 317 阅读 · 0 评论 -
Linux环境kill进程
kl.sh#!/bin/shproc=$1proctext=`ps -ef |grep -v grep | grep $proc`echo "$proctext"pid=`echo "$proctext" | awk '{print $2}'`echo "kill pid: $pid"sudo kill -9 "$pid"exit 0原创 2013-10-29 17:04:15 · 360 阅读 · 0 评论 -
Shell编程
1,变量赋值变量名=值注意:给变量赋值的时候,不能在=两边留空格2,shell默认赋值时字符串赋值,为达到数学计算效果,需要用以下几种表达方式:var=1var=$var+1 //1+1let "var+=" //2var=$[$var+1] //2var=`expr $var + 1` //23,shell里的流程控制if ...; th原创 2010-05-06 23:17:00 · 454 阅读 · 0 评论 -
Linux Shell for循环写法总结
关于shell中的for循环用法很多,一直想总结一下,今天网上看到上一篇关于for循环用法的总结,感觉很全面,所以就转过来研究研究,嘿嘿...1、 for((i=1;i2、在shell中常用的是 for i in $(seq 10) 3、for i in `ls`4、for i in ${arr[@]} 5、for i in $* ; do 6、for File转载 2013-08-06 13:06:56 · 373 阅读 · 0 评论 -
Kill Java daemon
Java,Shell原创 2015-01-05 17:11:08 · 266 阅读 · 0 评论