I have a file that contain this line
SELINUX = enforce
I want to change this by given input to permissive How i do that without demage?
I have a file that contain this line
SELINUX = enforce
I want to change this by given input to permissive How i do that without demage?
If [[ "$1" == "Y"]]
then
sed -ri 's/(^.*SELINUX=)(.*$)/\1enforce/' file
else
sed -ri 's/(^.*SELINUX=)(.*$)/\1permissive/' file
fi
If the first passed parameter ($1) is equal to "Y" use sed to split SELINUX line into to 2 sections. Substitute the line for the first section followed by "enforce". If the passed parameter is not "Y" substitute the line for the first section followed by "permissive".