#!/bin/bash
for myDate in 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#for myDate in 07
do
myDir=/mnt/nas1/int-cookie/2011-07-$myDate
echo -e "\n$myDir: Start Process"
proNum=0;
for myFile in `ls $myDir/*.gz`
#for myFile in `ls $myDir/us-wssearch-web*.gz`
do
((proNum++));
zcat $myFile | grep -i 'xylgroup\|cn1000368348\|cn1000317798\|cn1000311535\|cn1000261206\|cn1000244788' >> /home/admin/xuyuqin/$myDate.result
done
echo -e "$myDir: End Process[$proNum]\n"
done
方法1:
for 变量 in 常量列表; do 一些命令; done;
如:for file in `ls`; do echo $file; done;
for i in 1 2 3 4 5; do echo $i; done;
方法2:
for (( 变量初始化; 条件判断; 变量自变 )); do 一些命令; done;
如:for (( i = 0; i < 10; i++)); do echo $i; done;
MAX=10
for (( i = 0; i < MAX ; i ++ ))
do
echo `expr $i \* $i`
# echo $[$i * $i]
done