Web lists-archives.org

Re: [Mingw-users] messages




On Sat, 2007-12-29 at 22:53 +0100, Michael Gerdau wrote:
> > tried every combination of 1>&messages.txt 2>&1
> > Ampersands always become part of the filename.

1>&messages... is surely a typo; there *definitely* should *not* be an
ampersand in there, (unless you wanted a file called &messages.txt)!

2>&1, as Michael explains, means redirect stderr to the same destination
as file descriptor 1, which is stdout.  In this redirection context, the
ampersand only makes sense when followed by a *numeric* file descriptor.

> I haven't followed this discussion from the start but the above line
> most likely does not do what you want it to.
> 
> I assume what you are looking for is some like
> 
>    some_command >my_logile.txt 2>&1
> 
> which is a shorthand version of
> 
>    some_command 1>my_logile.txt 2>&1
> 
> It does redirect the stuff written to STDOUT (filehandle 1) to the
> file my_logfile.txt. It then does redirect STDERR (filehandle 2) to
> STDOUT (filehandle 1) which in turn is already redirected to
> my_logfile.txt.
> 
> Giving "&1" instructs the shell to not write to a file named "&1"
> (or "1") but to the filehandle number 1 (which usually is stdout).
> 
> In other words:
> writing "&" directly followed by a digit (or number) is a special
> syntax to write to filehandles.

But this is *nix shell redirection syntax; IIRC, it may also be
supported in cmd.exe, but it *doesn't* work in command.com, so if you
are still using a version of Woe32, (9x, IIRC), which still uses that
abomination as its native shell, then perhaps you should do yourself
a favour, by installing and using MSYS.

Regards,
Keith.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users