Re: Username length inconsistencies.
On Sun, May 31, 1998 at 11:32:18PM -0400, Alex Yukhimets wrote:
> > > Sure, this would work, but I was talking about _shell_script_ way of doing
> > > that...
> > if perl -e 'exit !!$>'; then
> > : root
> > else
> > : not
> > fi
> Wow, I think I'm going to open a zoo for root-checking methods:)
> Again, the above solution is OK for debhelper (as well as "id -u" one),
> but assuming that perl is present on the system is still non-portable.
> Most (if not all) commercial unices got shipped without perl...
So in that case (although if it doesn't have perl it doesn't deserve to
be called a *n?x in my opinion) here's another for your zoo:
if which perl; then
if perl -e 'exit !!$>'; then
if [ "x$USER" = "xroot" ]; then
But I think, that this is taking portability a little far. Just
include a nice little C source to do it and compile it at runtime if
it's that important to you.
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org