Zsh Mailing List Archive
Messages sorted by:
Re: Test failure in redirect.
- X-seq: zsh-workers 16560
- From: Zefram <zefram@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Test failure in redirect.
- Date: Tue, 5 Feb 2002 02:46:22 +0000
- Cc: Zefram <zefram@xxxxxxxx>, Felix Rosencrantz <f_rosencrantz@xxxxxxxxx>, zsh-workers@xxxxxxxxxx
- In-reply-to: <1020205023130.ZM28214@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20020131064103.12082.qmail@xxxxxxxxxxxxxxxxxxxxxxx> <1020204184533.ZM24919@xxxxxxxxxxxxxxxxxxxxxxx> <20020204210337.GA4456@xxxxxxxx> <1020205023130.ZM28214@xxxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer wrote:
>The "print" command has to execute, e.g. in case it's given -P and there
>are side-effects of the prompt expansion due to the PROMPT_SUBST option,
>but it must not produce any output and it definitely shouldn't return
The print command's purpose is to write certain characters to stdout.
In this case, it is unable to perform that operation, because stdout
isn't connected to anything. Why should the treatment of that case
differ from the case where it is unable to perform the intended operation
due to stdout being on a full filesystem? It seems to me that an error
message warning of the failure is appropriate in either case. Is there
any precedent for echo/print being silent about a closed stdout but
complaining about other error conditions?
The only argument I see for not treating a closed stdout as an error
when one attempts to write to it is to allow >&- to be used to throw
away output. What's wrong with >/dev/null? Is there a significant
amount of code that uses >&- instead of >/dev/null? I argue that such
code is broken.
>E.g. here's bash:
>[schaefer@zagzig schaefer]$ echo foo >&-
>[schaefer@zagzig schaefer]$ echo $?
I get results inconsistent with that:
zefram@bowl:~> echo foo >&-; echo $?
zefram@bowl:~> echo foo >/dev/full; echo $?
zefram@bowl:~> echo foo >/dev/null; echo $?
zefram@bowl:~> echo $BASH_VERSION
How does your version handle >/dev/full? I get identical results from
pdksh, by the way (i.e., >&- and >/dev/full both treated as errors,
$?=1 but no error message).
Messages sorted by: