[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Piping unpipable output.



Christian Lavoie <clavoie@enter-net.com> writes:
CL> I need to write down the output (actually, I need the error
CL> message) that the startx command gives me. (The nice 'startx >err'
CL> doesn't work...)

There are two places program output can go: "standard output" and
"standard error".  'cmd >file' only sends standard output to file;
standard error still gets displayed on the console.  In a
Bourne-compatible shell (ash/bash/ksh/zsh), you can do 'cmd 2>file' to 
send standard error (only) to file, 'cmd >&file' to send both standard 
out and standard error to file, 'cmd 2>&1' to send standard error to
the same place as standard output, 'cmd 2>&1 |less' to send that
output through less, etc.  csh/tcsh are less
powerful/flexible/forgiving here.

-- 
 _____________________________
/                             \       "Dad was reading a book called
|          David Maze         |     _Schroedinger's Kittens_.  Asexual
|         dmaze@mit.edu       |  reproduction?  Only one cat is in the box."
| http://donut.mit.edu/dmaze/ |               -- Abra Mitchell
\_____________________________/


Reply to: