in reply to Running System Commands With ""
Instead, consider using the system LIST syntax, e.g.:
# # add double-quote characters to either end of realname # # $realname = '"' . $realname . '"'; # commented out above line after fruiture pointed out that # system LIST format makes it unnecessary -- and even # wrong, since realname would then be stored with '"' # on either side! # run system command, but pass args directly to the # adduser program, rather than booting a shell if (!system("adduser", $username, '-g', '100', '-s', '/bin/false', '-d', "/home/$username", '-p', $encrypted_pass, '-e' $expiry_date, '-c' $realname ) ) { die "trouble adding user: returned non-zero\n"; }
This will:
See perldoc -f system.
update: fruiture pointed out that quotes were not needed in system LIST syntax.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Running System Commans With ""
by samurai (Monk) on Sep 11, 2002 at 20:20 UTC | |
by jkahn (Friar) on Sep 11, 2002 at 20:26 UTC | |
by merlyn (Sage) on Sep 12, 2002 at 17:04 UTC |