PS, in case it's not obvious how to use that fragment, something like this ought to work:

#!/bin/bash
id $1 | awk '{print $1}' | grep -q '(root)' && echo 'root!'

On Wed, 12 Oct 2005, J. Milgram wrote:

Maybe:
id | awk '{print $1}' | grep -q '(root)'

plus 999 other ways to skin the cat
meow.

On Wed, 12 Oct 2005, David Zakar wrote:

Anyone know of a fast way to shell script a check to see if the user is
root? I'd prefer something that works in sh for maximum compat.

(Yes, this should be very easy. My shell scripting knowledge is very
bad, though.)

-DMZ


Reply via email to