How can I check (in a safe way) if the current user has the permissions needed to shutdown the system on Unix & Linux?
I'm writing a script that needs to check to see if the current user has the permission needed to shutdown the system. But, of course, I want to determine this before actually attempting to shutdown the system.
Ideally, I'd like a solution that works on as many Unix & Linux distros as possible.
What can I execute in my script to check to see if the current user has permission to shutdown the system?