Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any way to allow clobbering empty files when noclobber is set?
- X-seq: zsh-workers 45959
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: Any way to allow clobbering empty files when noclobber is set?
- Date: Wed, 3 Jun 2020 19:43:11 -0700
- Cc: Martin Tournoij <martin@xxxxxxxxxx>
- In-reply-to: <20200604014850.52d241bd@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20200603020919eucas1p13e26ebcbb335784d14bfb97b137f385a@eucas1p1.samsung.com> <89aed74d-db7b-47ad-b218-8158838049e9@www.fastmail.com> <94e73ebcf39d4d3f9c7ae257b1d75d16@CAMSVWEXC01.scsc.local> <20200604014850.52d241bd@tarpaulin.shahaf.local2>
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