shell循环目录操作,尽量使用绝对路径,相对路径会报错
#!/bin/bash
for i in `ls /home/uepay/app`
do
if [ -d /home/XXX/app/${i} ]
then
cd /home/XXX/app/${i}
if [ -f /home/XXX/app/${i}/uepay.sh ]
then
echo "start xxx.sh script......."
sh uepay.sh restart
sleep 10
else
echo "file is not exits"
fi
fi
done