Check root user on solaris


/ Published in: Bash
Save to your folder(s)

Check if is root run this script.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.