The error results of useradd appear to go to STDERR instead of STDOUT.
You can redirect them to STDOUT, and therefore capture the results, like
this:

my $username='username';
my $rescmd=`/usr/sbin/useradd -s /bin/false $username 2>&1`;
chomp $rescmd;
print "Result is $rescmd\n";

On Fri, 2003-01-31 at 12:00, Martín Alejandro Carmona Selva wrote:

> $rescmd =""; # no error by default
> $cmd = "useradd -s /bin/false $useradd";
> $rescmd = `$cmd`;
> 
> The problem is that $rescmd stays empty. I know that it will be empty if 
> everything goes okay (since well, useradd returns nothing if no error 
> occours), but I'm trying to create an already existing user (to get the 
> error).


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to