[rancid] Checking for root
Matthew Walster
matthew at walster.org
Sat Jun 29 22:18:46 UTC 2013
On 28 June 2013 16:14, heasley <heas at shrubbery.net> wrote:
> +eval `id | sed -e 's/(.*//'`
> +test "$uid" -eq 0 && echo "Do not run $0 as root!" && exit 1
>
Would it not make more sense just to compare $UID -- that's set by the
shell. Essentially, you'd end up with:
if [[ $UID == 0 ]]
then
echo "Do not run $0 as root!"
exit 1
fi
Either way works, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20130629/9aa4c0dd/attachment.html>
More information about the Rancid-discuss
mailing list