I am trying launch adduser command from perl.
use strict;
use warnings;
my @test=('/usr/sbin/useradd',
"-c 'Fred'",
'-d /vol2/home/DMZ/f.kals',
'-g 3335','-u 11002',
"-k '/dev/null'",
'-m',
'-p "$1$kKNKMa8O$g03oj6YeeZbO2i3NMSoyT1"',
'fred');
system (@test);
When I executed the above, I got the following output:
[ay@pandora /vol2]$ sudo ./test.pl
useradd: invalid home directory ' /vol2/home/DMZ/fred'
Why?
If I do not use array
my $command="/foor/bar/useradd -m -g 1234 -u 6789 -param2 -param3 username"
system ($command);
that works OK.. why not array?