#!/bin/bash if [ ! "$(pwd | grep scripts$)" ] ; then echo "Working directory is wrong" exit 1; fi . _config.sh users=$(ls -d -l /home/* | grep -v 'lost+found' | grep -v $PUB_NAME | awk '{print $9}') for dir in $(find $PUB_PUBLIC_HTML -maxdepth 1 -mindepth 1 -name '*' -type d) ; do projectName=$(echo $dir | xargs basename) for user in $users ; do if [ -d "$user/public_html/$projectName" ] ; then projectName="" # якщо знайшили в когось проект, то лишаєм його break fi done if [ "$projectName" -a -d "$PUB_PUBLIC_HTML/$projectName" ] ; then echo Delete $PUB_PUBLIC_HTML/$projectName rm -IR $PUB_PUBLIC_HTML/$projectName fi done exit 0