linux常用命令备忘

当前日期
date +%Y%m%d%H%M%S

数组定义和遍历
paths=(“/root/dating/all2/process/dating” “/root/dating/all3/process/dating”)
for path in ${paths[*]}
do
gameDirs=ls -l $path |awk '/^d/ {print $NF}'
for i in $gameDirs
do
j=380
while [ $j -ge 8 ]
do
d=date -d "$j days ago" +%Y-%m-%d
echo “$path/$i/$d”
rm -rf “$path/$i/$d”
let j–
done
done
done

当前目录
DIR=$(cd dirname $0;pwd)