Re: bad file descriptor error in bash
On Sun, 09 Dec 2001, Eric G. Miller wrote:
> > home:~ #df 1>&-
> > df: write error: Bad file descriptor
> > Is it a bug?
> > ">&-" should be compatible with ">/dev/null", right?
Well, no. AFAIK, >&- means to *close* the stdout file descriptor, while
>/dev/null means to redirect (i.e. open) stdout to the /dev/null device.
This is a lot of difference.
> If it is, it must be with "df" as other programs don't complain.
df is right to complain. It wants to output to stdout, but there is no
stdout, so it can't output anything there.
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
Reply to: