On Fri, 23 Jun 2000 08:48:28 -0600, "Joe Schell" <jsch...@peakss.com>
> > Behalf Of Greg Thomas> > > > $val = `$abs -e "require $ver;" 2>&1`;> > I'm not exactly sure what is going on with> > the '2>&1' business.
> 2>&1 asks the shell to redirect file descriptor '2' to file descriptor 1.> Or a slightly different way to say it stderr is redirected to stdout.
Thanks for that - though interestingly the return value of the
backticks is never checked in MM_Win32 - just $?, so AIUI it would
probably be marginally more efficient just to use the return value
from system() rather than backticks and $?.
That said, both system() and $? from backticks are broken for me;
system() always returns 0, $? on backticks always return -1. It's
probably down to my shell ...
> It is also important to note that 'shell' in the above statement. As> someone was kind enough to point out to me not too long ago, the back tick> shell is not necessarily the same shell as what you ran the script in. I> can't recall it exactly but searching through Config.pm I found this line> > sh='cmd /x /c'> > And I would suppose you have something similar. And on a win 9x box that> does not allow redirection. You might try replacing that with one of the> shells you tried.
Thanks for the pointer. Despite running bash, Perl still drops down to
command.com as you suggest - I hadn't spotted that before.
Unfortunately the 'sh' config doesn't appear to be the solution. The
doc's describe 'sh' as "the full pathname of the shell used on this
system to execute Bourne shell scripts.", but setting it to
'c:\cgywin\bin\bash' still results in both backticks and system using
bad old command.com. I've tried setting the DOS environment variable
COMSPEC to point to bash, and checked Config.pm for other likely
candidates, but have got nowhere.
So, my problem seems to have come down to "How can I get Perl to use
bash not command.com when using backticks?"
Thanks again for everyones help,