码迷,mamicode.com
首页 > 系统相关 > 详细

shell 脚本示例

时间:2019-04-20 21:47:28      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:mnt   div   shel   示例   ast   pre   sleep   sub   mkdir   

#!/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

  技术图片

 

shell 脚本示例

标签:mnt   div   shel   示例   ast   pre   sleep   sub   mkdir   

原文地址:https://www.cnblogs.com/testzcy/p/10742449.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!