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

Re: Any way to allow clobbering empty files when noclobber is set?



On Wed, Jun 3, 2020 at 6:49 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> I certainly have several cases in my $HISTFILE where I repeated
> a command with «>» changed to «>!»,¹ in the pattern Martin described.

Are you sure you haven't set the HIST_ALLOW_CLOBBER option?

> ... thinking out loud, how about an
> option that does the following:
>
>     Given «foo > bar», if «foo» was run and exited non-zero and
>     NO_CLOBBER in effect [which implies that «bar» didn't exist before
>     foo was run], check whether «bar» is zero-size and, if so, unlink it.

How does that user experience differ from HIST_ALLOW_CLOBBER?  In
either of those cases, you have to retrieve the command from history
and execute it again ... and silently unlinking a file is not very
friendly.  The /etc/nologin example in your next message comes to
mind.



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