<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace"><span style="font-family:arial">On 28 June 2013 16:14, heasley </span><span dir="ltr" style="font-family:arial"><<a href="mailto:heas@shrubbery.net" target="_blank">heas@shrubbery.net</a>></span><span style="font-family:arial"> wrote:</span></div>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+eval `id | sed -e 's/(.*//'`<br>
+test "$uid" -eq 0 && echo "Do not run $0 as root!" && exit 1<br></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">Would it not make more sense just to compare $UID -- that's set by the shell. Essentially, you'd end up with:</div>
<div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">if [[ $UID == 0 ]]</div><div class="gmail_default" style="font-family:'courier new',monospace">
then</div><div class="gmail_default" style="font-family:'courier new',monospace"> echo "Do not run $0 as root!"</div><div class="gmail_default" style="font-family:'courier new',monospace"> exit 1</div>
<div class="gmail_default" style="font-family:'courier new',monospace">fi</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">
Either way works, though.</div></div></div></div>