bash versus sh test builtin

Jeffrey Goldberg jeffrey at goldmark.org
Sun Jan 11 19:41:35 PST 2009


On Jan 11, 2009, at 9:07 PM, Dan Nelson wrote:

> UID=$(id -u)
> if [ $UID -ne 0 ] ; then
> echo not root
> fi
>
> UID is not a variable set by /bin/sh, which is why the test fails.

Ah.  Thank you.  I was, as you see, barking up the wrong tree.  Thank  
you for setting me strait on this.

Cheers,

-j



More information about the freebsd-questions mailing list