1、写一个脚本(1)接受一个以上文件路径作为参数;(2)显示每个文件拥有的行数;(3)总结说明本次共为几个文件统计了其行数;#!/bin/bash
#
[$#-eq0]&&echo"Atleastonepath!"&&exit1
foriin$*;do
echo"$ihas$(wc-l$i|cut-d""-f1)lines."
done
echo
echo$#2、写一..
分类:
系统相关 时间:
2017-04-17 14:46:43
阅读次数:
254
在编辑struts.xml 文件时,“alt + /”无提示信息,需要在myeclipse 中添加消息头中的文件,步骤如下: 1. 选中该段复制 2. Preferences——>XML Catalog——>Add 3. 添加本地 .dtd文件路径 4. done... 如果不行关掉xml文件重启。 ...
分类:
其他好文 时间:
2017-04-15 09:33:20
阅读次数:
264
循环控制语句: continue:提前结束本轮循环,而直接进入下一轮循环判断; whileCONDITION1;do CMD1 ... ifCONDITION2;then continue fi CMDn ... done 示例:求100以内所有偶数之和; #!/bin/bash
#
declare-ievensum..
分类:
系统相关 时间:
2017-04-14 21:26:35
阅读次数:
1694
for i in `seq 1 $(cat /proc/cpuinfo |grep "physical id" |wc -l)`; do dd if=/dev/zero of=/dev/null & done 说明: cat /proc/cpuinfo |grep "physical id" | w ...
分类:
系统相关 时间:
2017-04-14 19:52:33
阅读次数:
4006
sys.c 代码分析 setregid /* * This is done BSD-style, with no consideration of the saved gid, except * that if you set the effective gid, it sets the saved ...
分类:
系统相关 时间:
2017-04-12 09:25:33
阅读次数:
356
untilCONDITION;dostatement……done条件为假,进入循环条件为真,退出循环for((ext1;ext2;ext3));dostatement……dongext1:变量赋初始值ext2:退出循环的变量值ext3:修改变量awk‘pattern{action}‘file每次读一行,按分隔符切割,全部字段$0,第一段$1,最后一段$NF,第1段和第2..
分类:
其他好文 时间:
2017-04-08 23:11:42
阅读次数:
173
for i in *;do mv "$i" "$i.mp4";done ...
分类:
系统相关 时间:
2017-04-08 21:18:16
阅读次数:
305
编写shell程序,实现自动删除50个账号的功能。账号名为stu1至stu50#!/bin/bash
foriin{1..50}
do
userdel-rstu0${i}//注意此处容易出错写成stu0{$i}
done
或者
#!/bin/sh
i=1
while[$i-le50]
do
userdelstu${i}
i=$(($i+1))
done
分类:
其他好文 时间:
2017-04-07 19:03:05
阅读次数:
117
while适用于循环次数未知语法:whileconditions;dostatement……done练习#!/bin/bash#who|grep‘username‘>/dev/nullwhile[$?!=0];dosleep5echo`date+T`who|grep‘username‘>/dev/nulldoneecho"usernameislogin"
分类:
其他好文 时间:
2017-04-06 23:55:09
阅读次数:
337
#!/bin/bash
#mysqldinstallscripts
#displayProgress
Progress(){
b=‘‘
i=0
while[$i-le100]
do
printf"$*:[%-50s]%d%%\r"$b$i
sleep0.001
i=`expr2+$i`
b=#$b
done
echo
}
#ifCentosVersion
Centos_version=$(cat/etc/redhat-release|awk‘{print$4}‘|cut-b1)
wget-o/dev/nul..
分类:
数据库 时间:
2017-04-05 18:24:11
阅读次数:
252