Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

'>>' does not create file if set -C (noclobber) is active



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