shell---practice3
#!/bin/bash //程序开始#File: chmod.sh
#Date: 2016-01-13
dir="/tmp/scripts/" //将目录赋值给变量
if [ ! -d "$dir" ] ; then //此if语句判断目录,不存在就创建
mkdir -p $dir
else
echo "This dir is exists."
fi
rm -rf /tmp/scripts/* //清除目录下的所有内容
cd $dir && cp -R /etc/pam.d . && mv pam.d test //拷贝目录并修改目录名
rm -rf /home/redhat || useradd redhat && groupadd redhat //创建用户和组
if [ $? -eq 0 ] ; then //此if语句用来修改属性
chown -R redhat:redhat $dir/test
chmod -R o-x $dir/test
echo "Congratulations, your work is OK!"
else
echo "Test directory permisson can't change!"
fi //程序开始
页:
[1]