[Discuss] test for *other* write permissions
Edward Ned Harvey (blu)
blu at nedharvey.com
Fri Nov 16 09:44:01 EST 2012
Thanks for suggestions everyone. This is the best solution because it's clearly understandable and readable, doesn't have any external dependencies (like possibly unavailable or varying versions of perl/awk/sed/python/selinux)
Bash, apparently, can do octal arithmetic by using the 8#
PERM=`stat -c '%a' /etc/resolv.conf`
let OWRITABLE="8#$PERM & 8#002"
let GWRITABLE="8#$PERM & 8#020"
if [ $OWRITABLE -ne 0 -o $GWRITABLE -ne 0 ] ; then
...
fi
More information about the Discuss
mailing list