cvg2mco has asked for the wisdom of the Perl Monks concerning the following question:
I read this config file and assign $cmd as soCMD|/opt/sudo/sudo /usr/bin/su - $ENV{LOGNAME} -c "$someScript"
I was expecting thaT the value for the $ENV{LOGNAME} would be substituted in the system(). But for some reason it is is not capturing the value. Here's whats confusing -I explictly assigned $cmd asmy $cmd = (split /\|/, $configLine)[1]; system("$cmd");
Now it recognizes the value of $ENV{LOGNAME}.. What am i doing wrong in the config file? Note: I have to read commands from the config file only per design. Any help is greately appreciated. Thanksmy $cmd = "/opt/sudo/sudo /usr/bin/su - $ENV{LOGNAME} -c \"$someScript +\" "; system("$cmd");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with string literal in system()
by cephas (Pilgrim) on Sep 22, 2006 at 02:02 UTC | |
by ikegami (Patriarch) on Sep 22, 2006 at 02:11 UTC | |
by cephas (Pilgrim) on Sep 22, 2006 at 03:23 UTC | |
by ikegami (Patriarch) on Sep 22, 2006 at 05:09 UTC | |
| |
by cvg2mco (Novice) on Sep 22, 2006 at 22:06 UTC |