On a script, I need to have it enter in information into /etc config files. Typically, to prove a point I will just use echo "lalala" > file, but occasionally I rather it just change the information in it, helps in 2 things. A. I don't have conflicting information, and B. I can run the script more than once.
if grep --quiet "umask 077" /etc/profile; then
echo "umask is set"
else
sed -i 's@umask 022@umask 077@g' /etc/profile
fi
If umask 077 is in /etc/profile, then we are good. If not, it will find umask 022 and change it to umask 077.
No comments:
Post a Comment