How do I determine if a shell script is running with root permissions?

Viewed 8926

I've got a script I want to require be run with su privileges, but the interesting scripted command that will fail comes very late in the script, so I'd like a clean test up front to determine if the scrip will fail without SU capabilities.

What is a good way to do this for bash, sh, and/or csh?

2 Answers
Related