【shell脚本】一个移动xxx文件到指定目录的脚本

直接上脚本,拿走不谢

#!/bin/bash
cd /home/biztech
var=$(date +%Y%m%d)
autotestDir='autotest_xxx_'$var
#echo $autotestDir
echo "move *.rpm start"
number=$(ls | grep [0-9]*[0-9].rpm | wc -l)
#echo $number
if [ $number -gt 0 ]
then
    if [ ! -d "$autotestDir" ]
    then
        /bin/mkdir "$autotestDir"
    fi
    mv *.rpm $autotestDir/
    echo "move *.rpm done!"
else
    echo "no *.rpm need to move!"
fi

你可能感兴趣的:(shell)