nirvanaPL has asked for the wisdom of the Perl Monks concerning the following question:
I have aperl script that does a series of processing and if a condition is met it executes a shell script. The shell script and the perl module live in the same directory location. However, I get the following error with its call. I have also tried a chdir before the shell script is executed and provide the path+shell_script (/dir/shell.sh)but the same error message every time.</P
Can't exec "sh": No such file or directory at ../home/lib/dirA/perl_script.pm line 91 (#1) (W exec) A system(), exec(), or piped open call could not execute the named program for the indicated reason. Typical reasons include: the permissions were wrong on the file, the file wasn't found in $ENV{PATH}, the executable in question was compiled for another architecture, or the #! line in a script points to an interpreter that can't be run for similar reasons. (Or maybe your system doesn't suppo +rt #! at all.)
shell script
chdir "/home/lib/dirA/"; system("sh shell_script.sh");
I got curious so I built a simple perl script with only one command to call the same shell script and it completes without any error.
I have tried to research the warning errors but I have not found anything significant. Any insight is greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: call a shell script from a perl script
by NetWallah (Canon) on Jan 15, 2014 at 16:34 UTC | |
by nirvanaPL (Novice) on Jan 15, 2014 at 16:54 UTC | |
|
Re: call a shell script from a perl script
by toolic (Bishop) on Jan 15, 2014 at 15:02 UTC |