#!/bin/sh
#written by dmer
corepath=/corefiles
#echo $corepath
if [ -d $corepath ];then
#echo aaaa
if [ $(state -c %a $corepath) -ne 777 ]; then
#echo bbbb
chmod 777 $corepath
fi
else
#echo dddd
mkdir $corepath
chmod 777 $corepath
fi
exit 0
-------------------------------------------------------------------------------------------
解释: -d $corepath 存在并且是文件夹
$(state -c %a $corepath) -ne 777 传入的文件状态权限八进制 不等于777