Posted By

vikiyou on 03/21/11


Tagged

bashroot


Versions (?)

Check root user on solaris


 / Published in: Bash
 

Check if is root run this script.

  1. if_root()
  2. {
  3. _user=`id | awk -F')' '{print $1}' | awk -F'(' '{print $2}'`
  4. if [ "$_user" == "root" ]; then
  5. # is root
  6. return 0
  7. else
  8. # not root
  9. return 1
  10. fi
  11. }

Report this snippet  

You need to login to post a comment.