shell 脚本示例

#!/bin/sh
#while true
#do
cd /mnt/vfw/third_meteor
for sub in `ls`
do
        cd /mnt/vfw/third_meteor/${sub}/GRIDFILE
        for file in `ls |grep back`
        do
                cd /mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}
                for pvd in `ls -lrt | grep ^d | awk '{print $9}'`
                do
                        cd /mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}/${pvd}
                        if [ -d /home/centos/mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}/${pvd} ];
                        then
                                for file_last in `ls -rlt *.PVD|tail -n 3 | awk '{print $9}'`
                                do
                                        echo ${file_last}
                                        #cp -rp *.PVD /home/centos/mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}/${pvd}
                                        cp -rp $file_last /home/centos/mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}/${pvd}
                                done
                        else
                                mkdir -p /home/centos/mnt/vfw/third_meteor/${sub}/GRIDFILE/${file}/${pvd}
                        fi

                done
        done


done
#sleep 900
#done

  

 

posted on 2019-04-20 20:05  我和你并没有不同  阅读(440)  评论(0编辑  收藏  举报