I was creating a script and I can't figure out why this isn't working....
Code:
my $priv = system "whoami";
if ($priv ne "root"){
say "FATAL ERROR: you may only run this as root. User found running script: $priv";
die;
}
when I try to execute it, this happens:
Code:
root
FATAL ERROR: you may only run this as root. User found running script: 0
Died at hostcheck.pl line 42.
Why is my value changed to 0? It's like it's checking it as a scalar value...