in reply to shell within system() call
When system executes a shell — it doesn't always — Perl uses the shell identified by the following:
$ perl -MConfig -le'print $Config{sh}' /bin/sh
It may be possible to redefine it when you build Perl or maybe even by changing Config.pm, but that could cause problems. Instead, simply execute the desired shell explicitly (as shown by almut).
Be sure to use multi-argument form of system. If you do Perl is guaranteed* to avoid launching /bin/sh in addition to the desired shell.
system('/bin/ksh', '-c', '. /env.ksh ; shellFunction'); # Good system('/bin/ksh -c ". /env.ksh ; shellFunction"'); # Poor
* — Guarantee void on Windows.
|
|---|