小白继续求学路求解linux语句
这个先把整段贴出来以免误导大家断章取义,
if [ "$tag1" = '-fail' ]
then
tt=`perl -le 'use POSIX ; print strftime("%Y%m%d%H%M.%S\n", localtime(time()-900));'`
touch -t $tt $HOME/tfile1
find /opt/Roamware/logs/amms/events/ -name "amms-events*" -newer $HOME/tfile1 |sort |xargs gzgrep "20" > $HOME/tfile2
if [ -z "$obj1" ] # if obj1 is null
then
awk -F"," '$5=="0"&&$6=="2"&&$8=="2"&&$13=="4"&&$20=="1" {print $11}' $HOME/tfile2 |sort -u > ~/prepaid_all.list
awk -F"," '$5=="0"&&$6=="3"&&$8=="2"&&$13=="4" {print $11}' $HOME/tfile2 |sort -u > ~/prepaid_succ.list
comm -23 ~/prepaid_all.list ~/prepaid_succ.list
else
awk -F"," '$5=="0"&&$6=="2"&&$8=="2"&&$9=='"$obj1"'&&$13=="4"&&$20=="1" {print $11}' $HOME/tfile2|sort -u > ~/prepaid_all.list
awk -F"," '$5=="0"&&$6=="3"&&$8=="2"&&$9=='"$obj1"'&&$13=="4" {print $11}' $HOME/tfile2 |sort -u > ~/prepaid_succ.list
comm -23 ~/prepaid_all.list ~/prepaid_succ.list
fi
rm -f ~/prepaid_all.list ~/prepaid_succ.list
rm -f $HOME/tfile1 $HOME/tfile2
exit
fi
-----------------------------------
下面开始提问
第一步:tt=`perl -le 'use POSIX ; print strftime("%Y%m%d%H%M.%S\n", localtime(time()-900));'`这个一是语义费解such as =`perl -le 'use POSIX ; strftime,二是层次不清晰,for example 里面有分号,分号竟然被单引号扩了起来
第二步:touch -t $tt $HOME/tfile1 是创建文件tfile1,并且创建时间设置为$tt吗,费解
第三步:find /opt/Roamware/logs/amms/events/ -name "amms-events*" -newer $HOME/tfile1 |sort |xargs gzgrep "20" > $HOME/tfile2额 看到就头晕-newer意思是找到比参数文件修改晚的吗,ok?then xargs什么的干活,and xargs gzgrep "20"组合起来是什么,有这种用法吗
第四步:rm -f ~/prepaid_all.list ~/prepaid_succ.list 这句话嘛意思,特别强调参数f的作用?
[解决办法]
[xuhao@/export/home/xuhao]alias rm
bash: alias: rm: not found
怎么设置呢,为什么叫别名,应该是一种模式吧