On Tuesday 30 October 2007 14:14, David C. Rankin J.D. P.E. wrote: > Listmates, > > In a script, I need to test that the user is either root or has su'ed > to root before continuing. The USER in the environment remains the > original user and there is nothing set related to 'su'. Any thoughts?
A bit more obvious (but starting an external program) than checking $UID for 0: whoami This uses the effective (!) user ID, i.e. it also returns "root" for "su" or "sudo". CU -- Stefan Hundhammer <[EMAIL PROTECTED]> Penguin by conviction. YaST2 Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Nürnberg, Germany -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]