read -p "please input character set selinux for {start|stop} :" SE
SEC=$(sed -rn 's@^SELINUX=(.*)@\1@'p /etc/selinux/config)
if [ $SE == 'start' ];then
if [ $SEC == 'enforcing' ];then
echo "selinux current status is enforcing"
elif [ $SEC == 'disabled' ];then
sed -ri 's@^SELINUX=(.*)@SELINUX=enforcing@' /etc/selinux/config && echo "selinux start succeed"
fi
elif [ $SE == 'stop' ];then
if [ $SEC == 'disabled' ];then
echo "selinux current status is disabled"
elif [ $SEC == 'enforcing' ];then
sed -ri 's@^SELINUX=(.*)@SELINUX=disabled@' /etc/selinux/config && echo "selinux stop succeed"
fi
fi