Posted By

vikiyou on 11/20/10


Tagged

isrootperllinux


Versions (?)

isroot


 / Published in: Perl
 

Check if the user is root with Perl in Linux.

  1. sub isroot {
  2. my $uid = `id -u`;
  3. if ($uid != 0) {
  4. return 0;
  5. } else {
  6. return 1;
  7. }
  8. }

Report this snippet  

You need to login to post a comment.