前端之家收集整理的这篇文章主要介绍了
检测目录下所有符合名称的目录,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
过滤当前目录下的文件,进入符合条件要求的目录,然后判断更新文件是否存在,然后执行脚本。
#!/usr/bin/env bash
basepath='/var/www/html' cd $basepath
@H_502_28@for dir @H_502_28@in $(ls $basepath)
@H_502_28@do @H_502_28@ if [ -d $dir@H_502_28@ ] ; @H_502_28@then @H_502_28@ if [[ $dir @H_502_28@=~ "_public"@H_502_28@ ]] ; @H_502_28@then @H_502_28@ echo $dir
cd $dir
@H_502_28@for file @H_502_28@in $(ls `pwd`)
@H_502_28@do @H_502_28@ if [[ $file @H_502_28@=~ "update.sh"@H_502_28@ ]] ; @H_502_28@then
bash $file break
@H_502_28@fi @H_502_28@ done @H_502_28@ cd ..
@H_502_28@fi @H_502_28@ fi @H_502_28@done