Command in perl script not working

perl

When I place this command in a perl script, it won't work:

`chkconfig --level 3 nslcd on`;

But if I execute it on a linux command shell, it works.

[root@barf Scripts]# chkconfig --level 3 nslcd on

I'm curious on why it does't work in a perl script.

TIA

Best Answer

Does using

print `chkconfig --level 3 nslcd on`;

instead "fix" it? If yes, the answer is found here: https://stackoverflow.com/questions/799968/whats-the-difference-between-perls-backticks-system-and-exec

Backticks in Perl execute with a system() call, and their return value will be the STDOUT of the called command.

Related Topic