Add a convenience script to start msysGit in WINE
[msysgit.git] / mingw / doc / redir / README
blobd3ad15712bfb60e9f684ed2c7b1f41d555b64a8e
1 This is a simple port of DJGPP's redir utility for those who're stuck with
2 braindead COMMAND/CMD shells on windows32 that cannot redirect standard
3 error correctly.
5 Here's the documentation provided with DJGPP's redir utility (also
6 provided in the .zip file):
8                                      redir
9                                        
10    DOS, in its many flavors and versions, lacks a decent I/O redirection
11    mechanism. Sure, it's got < and > and >>, but what about error
12    messages? Lots of people ask, "How do you send those error messages to
13    a file?" Well, you use a program like redir.
14    
15    redir is basically a program that manipulates the standard file
16    descriptors by copying them, closing and opening them, etc. Once it
17    has the file descriptors where it wants them, it runs your program,
18    which inherits the changed descriptors. Thus, redir has nearly
19    complete control over the input and output of your program.
20    
21    It also allows you to view the exit code of the program, and the
22    elapsed time of the program, by supplying the appropriate options on
23    the command line.
24    
25    Note that redir is built with command-line expansion and response
26    files disabled, so as to allow the application to control that
27    themselves. This means that you can't use those features to provide
28    redir's options or the command name, but if you use them for the
29    command's options, the command will do the expansion if it wants to.
30    
31    The exit code of redir is 1 if it exits on its own accord, else it
32    returns the same error code as the program it runs.
33    
34    Usage: redir [-i file] [-o file] [-oa file] [-e file] [-ea file] [-eo]
35    [-oe] [-x] command [args . . .]
36    -i file
37           Redirect stdandard input from file
38    -o file
39           Redirect standard output to file
40    -oa file
41           Append standard output to file
42    -e file
43           Redirect standard error to file
44    -ea file
45           Append standard error to file
46    -eo
47           Redirect standard error to standard output
48    -oe
49           Redirect standard output to standard error
50    -x
51           Print the exit code of the command after it exits. If the exit
52           code is 0..255, it is printed as is. If it is not, the low byte
53           (0..255) is printed in decimal and the whole value is also
54           printed in hex.
55           
56    Options are processed in the order they are encountered. Thus, "-o foo
57    -eo" means "redirect output to foo, then redirect errors there also",
58    whereas "-eo -o foo" means "send errors to where output was going,
59    then move output to foo".
60    
61    Examples:
62    
63    To redirect errors to a file:
64 redir -e errors.lst command ...
66    To redirect output to a file, and errors through a pipe:
67 redir -eo -o prog.out command ... | pipe