Reinstein, Shlomo wrote:
> Thanks for the detailed reply!
> Before this sample script, I actually thought that your idea was bad because
> every type of shell or operating system has its own way of redirecting the
> standard error -- but you proved me wrong (or is it Perl that always
> launches the same type of shell when it runs backticks, and this is why it
> works?). I really didn't know that this error redirection is uniform in all
> shells and operating systems. (At least those we use, Linux and Windows with
> several shells in each.) I was surprised to see that this worked on both
> "cmd" on Windows, and on "tcsh" and "bash" on Linux.

        I don't believe that it will work on tcsh, or any csh for that matter, since 
csh uses a different syntax to redirect stderr.  However, perl uses bourne 
shells by default for backtick evaluation, so the perl script will catch the 
stderr of its evaluated expression, even when invoked from a csh.  Such 
redirection (or anything for that matter) is not consistent from shell to 
shell.  Perl explicitly looks for a standard bourne shell (barring that, a 
shell that supports standard bourne behavior such as bash) when installing in 
an attempt to get reasonably consistent behavior.  However, this becomes 
problematic on systems like NT.  ActivePerl invokes CMD.EXE, whereas the 
perl.exe installed with Cygwin uses ash (a vanilla bourne shell) - these two 
behave quite differently.  However, if you limit the use of backtiks in Perl 
to output capture as shown, you will find your scripts pretty darn portable, 
as CMD.EXE supports bourne style command redirection.


/|/|ike


_______________________________________________
Info-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/info-cvs

Reply via email to