REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Redirect STDOUT and STDERR


If you want to redirect STDOUT and STDERR of an OS/2 command, you should 
always redirect STDERR first. If, instead, the reverse of this is used, 
some programs (including CMD.EXE) sometimes write their error messages to 
the display regardless of the redirection of STDERR. 
To redirect STDOUT and STDERR into the same FILE use the following 
construct: 

 
  "attrib a:test.cmd 2>>errFile 1>>&2"

To redirect STDOUT and STDERR into the same PIPE use the following 
construct: 

 
  "attrib a:test.cmd 2>&1 | pipeit.cmd"


Please note that other command line interpreter, such as 4OS2, for 
instance, may use another syntax for the redirection of STDOUT and/or 
STDERR. 
  
Note:   See also STDOUT / STDERR 
   

Inf-HTML End Run - Successful