Hi everyone. This is a bit of a perl/linux mixed question. I am trying to redirect STDOUT of chsh by using the following line of perl code.
system ("chsh -s /sbin/nologin $testing[0] 1>/dev/null");
This should redirect STDOUT to /dev/null but it won't do that for some odd reason. Any ideas or suggestions? Thanks in advance.
Other info:
The $testing[0] is part of an array that contains the name of the account that needs its shell changed to /sbin/nologin.
What is the output that you are getting?
Well...say the account having its shell changed is 'news'.
I get the output of.
How big is your Perl script? Can you post it's full contents here?
The only code in this script is:
START:
@testing = `awk -F: '{if (\$7 =="") {print \$1}}' /etc/passwd`;
if ($testing [0] =~ m/[[:print:]]/)
{
system ("chsh -s /sbin/nologin $testing[0] 1>/dev/null");
goto START;
}
---------- Post updated at 02:50 PM ---------- Previous update was at 01:58 PM ----------
Any ideas?
Is the output on stdout and not stderr (fd2)?
Try something like this :
START:
@testing = `awk -F: '{if ($7 =="") {print $1}}' /etc/passwd`;
if ($testing[0] =~ m/[[:print:]]/) {
#system ("chsh -s /sbin/nologin $testing[0] 1>/dev/null");
`chsh -s /sbin/nologin $testing[0] 1>/dev/null`;
goto START;
}