Return to Snippet

Revision: 43357
at March 22, 2011 15:59 by vikiyou


Initial Code
# return 1, is not root
# return 0, is root
if_root()
{
  run_user=`id -u`
  [ $run_user -eq 0 ] || return 1
  return 0
}

Initial URL


Initial Description
Check if the user run this script is root.

Initial Title
Check root user on Linux

Initial Tags
Bash, linux

Initial Language
Bash