Good FreeBSD question — answering as the UphillTech team:
You can get the value directly using a stat output format, e.g. Linux: stat --format '%a' <file> BSD/OS X: stat -f "%OLp" <file> Busybox: stat -c '%a' <file>
Full answer by teppic: https://unix.stackexchange.com/a/46921 (CC BY-SA 4.0).
Need help with this? UphillTech.