backtick redirection question

C

Chris Bohn

Using an extremely old version of perl:

-------------------
This is perl, version 5.003_07

Copyright 1987-1996, Larry Wall

+ suidperl security patch
Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
All rights reserved.
Developed by ActiveWare Internet Corp., http://www.ActiveWare.com

Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998
-------------------

The following command would work:

cvs -l commit -m"package imports updated:
softcon/rribase_dll (beta_102) -> (release_124)
" vers.dat 2>&1

executed via something like

$basic = qq#commit -m"package imports updated:\n @updatedPackages" vers.dat#;
$flags = " -l ";
$cmd = "cvs $flags $basic 2>&1";
@return = `$cmd`;

The @updatedPackages really isn't relevant; it can be replaced with static text,
and the problem still exists.

Under a current version of perl:

-------------------
This is perl, v5.8.2 built for MSWin32-x86-multi-thread
(with 25 registered patches, see perl -V for more detail)

Copyright 1987-2003, Larry Wall

Binary build 808 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Dec 9 2003 10:19:40
-------------------

the same perl code doesn't work. Instead of executing

cvs -l commit -m"package imports updated:
softcon/rribase_dll (beta_102) -> (release_124)
" vers.dat 2>&1

as it did with the old perl version, it executes the equivalent of

cvs -l commit -m"package imports updated:

It basically stops at the \n character. This results in a different command
running (instead of running just on one file, vers.dat, it recurses through all
directories).

The problem is the
2>&1
piece to redirect stderr to stdout. If I take just that piece of the command
off, the correct and complete command is executed. I can also remove the \n,
and everything works, but I want the newline. I want to be able to redirect
stderr to stdout so that I can capture the output from cvs. I realize I could
capture them separately, but I want to capture it as I would have seen it on the
screen (so output from stderr intermixed with output from stdout), so I think I
need to do the redirection this way. I don't know why this won't work with the
current perl. Any help or suggestions would be appreciated.

thanks
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top