On 2012-11-16 06:07, Edward Ned Harvey (lopser) wrote:
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)


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


I agree that it is preferable to use bash (or whatever shell you are using) over an external apps if it can do it, but would like to point out that:

-bash is not static, it is evolving, and online documentation tends to be for the latest version. When you write a script, it is important to make sure it works for the oldest version of bash you have out of all your targets.

-I believe bc and dc syntax has been fairly static for the past few decades! They are powerful tools, I think people don't tend to use them mainly because they have forgotten about them.

--
Yves.                                                  http://www.SollerS.ca/
                                                       http://ipv6.SollerS.ca
                                                       http://blog.zioup.org/

_______________________________________________
Tech mailing list
[email protected]
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
http://lopsa.org/

Reply via email to