Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
'>>' does not create file if set -C (noclobber) is active
- X-seq: zsh-workers 35595
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: '>>' does not create file if set -C (noclobber) is active
- Date: Thu, 25 Jun 2015 03:02:58 +0200
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
If the 'noclobber' option (set -C) is active, the append ('>>') output
redirection will not create a file if it doesn't exist.
% set -C
% echo hi >> blah
zsh: no such file or directory: blah
POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_03
"If the file does not exist, it shall be created." It does not mention
that the noclobber option should influence this.
By definition, a file that doesn't exist cannot be clobbered, so it
seems to me that logically this shell option shouldn't apply.
bash, (d)ash, ksh93, mksh, and yash all act like POSIX says.
I have no opinion on whether this should be an overall fix or a fix for
the emulation modes.
Thanks,
- Martijn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author