Here is the piece of code I have used: ROOT_UID=0 # Only users with $UID 0 have root privileges. E_NOTROOT=67 # Non-root exit error. if [ "$UID" -ne "$ROOT_UID" ]; then echo "Must be root to run this script." exit $E_NOTROOT fi
There is a forum about bash scripting: http://bashscripts.org/ Bogdan On 10/30/07, David C. Rankin J.D. P.E. <[EMAIL PROTECTED]> 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? > > -- > David C. Rankin, J.D., P.E. > Rankin Law Firm, PLLC > 510 Ochiltree Street > Nacogdoches, Texas 75961 > Telephone: (936) 715-9333 > Facsimile: (936) 715-9339 > www.rankinlawfirm.com > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Bogdan Cristea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]