zsh-workers
 help / color / mirror / code / Atom feed
* '>>' does not create file if set -C (noclobber) is active
@ 2015-06-25  1:02 Martijn Dekker
  2015-06-25  1:49 ` Bart Schaefer
  0 siblings, 1 reply; 26+ messages in thread
From: Martijn Dekker @ 2015-06-25  1:02 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-07-31 14:02 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25  1:02 '>>' does not create file if set -C (noclobber) is active Martijn Dekker
2015-06-25  1:49 ` Bart Schaefer
2015-06-25  2:22   ` Martijn Dekker
2015-06-25  7:30     ` Bart Schaefer
2015-06-25 14:04       ` Stephane Chazelas
2015-06-25 16:00         ` Bart Schaefer
2015-06-25 19:20           ` Chet Ramey
2015-06-26 14:14       ` Martijn Dekker
2015-06-26 20:15         ` Bart Schaefer
2015-06-27  1:54           ` Martijn Dekker
2015-06-27  3:38             ` Bart Schaefer
2015-06-27 17:02         ` Peter Stephenson
2015-06-28  0:02           ` Martijn Dekker
2015-06-28  0:46             ` Martijn Dekker
2015-06-28  7:48             ` Stephane Chazelas
2015-06-28  9:15               ` Oliver Kiddle
2015-06-28 14:00                 ` Stephane Chazelas
2015-06-28 18:38                   ` Bart Schaefer
2015-06-28 19:30                     ` Stephane Chazelas
2015-07-23  2:56                     ` PATCH: sysopen (was Re: '>>' does not create file if set -C (noclobber) is active) Oliver Kiddle
2015-07-24 10:57                       ` Peter Stephenson
2015-07-24 11:55                         ` Peter Stephenson
2015-07-30 11:05                           ` Mikael Magnusson
2015-07-31 12:41                         ` Oliver Kiddle
2015-07-31 14:02                           ` Mikael Magnusson
2015-06-28 17:19             ` '>>' does not create file if set -C (noclobber) is active Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).