Click to See Complete Forum and Search --> : Quick question: I forgot how to redirect stdout-->stdin


MBMarduk
08-21-2001, 01:18 PM
I checked the NHFs but could find it in the usual places.
I just tried these:
$program &2>1 ~/textfile
$program 2&1> ~/textfile
$program 2>&1 ~/textfile
$program 2&>1 ~/textfile

but they don't seem to work...
The program in question is X and I want the error messages put in a file to view later.

wittysaint
08-21-2001, 03:01 PM
try program 2&>~/textfile

not sure though :confused:

bdg1983
08-21-2001, 05:05 PM
program 2>&1 ~/textfile should work

or just

program > textfile

Which send the programs output to the file textfile.

[ 21 August 2001: Message edited by: mdwatts the 3rd ]

Strike
08-21-2001, 05:12 PM
If you want to redirect STDOUT of one program to STDIN of another, that's what a pipe does.

foo | bar

redirects STDOUT of foo to STDIN of bar

MBMarduk
08-21-2001, 05:26 PM
Originally posted by Strike:
<STRONG>If you want to redirect STDOUT of one program to STDIN of another, that's what a pipe does.

foo | bar

redirects STDOUT of foo to STDIN of bar</STRONG>

You're right. Maybe what I meant to ask was STDERR to STDIN??
In any case, the text that appears when X starts up doesn't go nicely into a file like I wanted it to.
Thanx for the replies as always.
-Mike