/ Published in: Bash
                    
                                        
Check if the user run this script is root.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
# return 1, is not root
# return 0, is root
if_root()
{
run_user=`id -u`
[ $run_user -eq 0 ] || return 1
return 0
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                