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

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



Bart Schaefer schreef op 25-06-15 om 03:49:
> On Jun 25,  3:02am, Martijn Dekker wrote:
> }
> } If the 'noclobber' option (set -C) is active, the append ('>>') output
> } redirection will not create a file if it doesn't exist.
> } 
> } POSIX:
> 
> The noclobber option is an extension, and has nothing whatsoever to do
> with POSIX.  It is not normally on in any emulation, so as soon as you
> set it you're off in the weeds and appeal to POSIX is meaningless.

That is not correct.

See:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25

-C
    (Uppercase C.) Prevent existing files from being overwritten by the
shell's '>' redirection operator (see Redirecting Output); the ">|"
redirection operator shall override this noclobber option for an
individual file.

[...]

-o  option
[...]
noclobber
    Equivalent to -C (uppercase C).

Thanks,

- M.



Messages sorted by: Reverse Date, Date, Thread, Author