Dan Jacobowitz <[EMAIL PROTECTED]> writes: > 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... > > > > Wow, I think I'm going to open a zoo for root-checking methods:) > > > 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:
Agrees... :) Perl's the best!! :D > 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. Or, can one expect awk to be in _every_ unix? In that case, here's a portable way (with awk) for the zoo... :) (This can be optimized quite a bit, but I'm feeling lazy today... :) ----- s n i p p ----- #!/bin/sh ID=`id | awk -F= '{print $2}' | awk -F\( '{print $1}'` if [ "$ID" = "0" ]; then iamroot else iamnot fi ----- s n i p p ----- -- ------------------------------------------------------------------------------- Turbo ___________ Debian GNU/Linux Unix _IS_ user friendly - it's just ^^^^^ ___ /___(_)__________ _____ __ selective about who its friends are __ / __ /__ __ \ / / /_ |/_/ _ /// _ /___ / _ / / / /_/ /__> < Turbo Fredriksson Tel: +46-704-697645 \\\/ /_____/_/ /_/ /_/\__,_/ /_/|_| S-415 10 Göteborg [EMAIL PROTECTED] PGP#788CD1A9 SWEDEN www5.tripnet.se/~turbo ----------- PGP: B7 92 93 0E 06 94 D6 22 98 1F 0B 5B FE 33 A1 0B ------------ -- Treasury kibo quiche Saddam Hussein counter-intelligence KGB Clinton Delta Force strategic Honduras Semtex explosion terrorist nuclear Kennedy -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]