zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Using Zsh on a embedded system to configure GPIOs
Date: Sat, 29 Nov 2014 21:03:07 +0100	[thread overview]
Message-ID: <CAHYJk3QzGV3Cg+swu+1Uo6JocO7zVGSr6rPgaXhO_M78u6G47w@mail.gmail.com> (raw)
In-Reply-To: <141129113521.ZM1621@torch.brasslantern.com>

On Sat, Nov 29, 2014 at 8:35 PM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> On Nov 29, 10:10am, meino.cramer@gmx.de wrote:
> }
> } To overwrite files I need to use ">!" instead of ">".
> }
> } Is there any way to automate this feature NOT to hit on my fingers,
> } if I want to write to files below /sys, /proc,, /dev...or
> } (better) to recognize, if such a file is a virtual one?
>
> I confess to being confused by the phrase "to hit on my fingers" ...
> but I think I can answer anyway.
>
> The HIST_ALLOW_CLOBBER option replaces ">" with ">|" in the history,
> so that if you forget to use the clobbering form all you need to do
> is recall the previous command with "!!" or the line editor.  Does
> that help?
>
> NO_CLOBBER already behaves differently for non-regular files, so that
> you can do things like "print foo > /dev/pts/3" without having to use
> ">|" (though that won't work for /dev/tty for a different reason).
>
> So if there is some way to identify a "virtual file" e.g. with stat(),
> that could potentially also be handled.  However, I think virtual files
> masquerade pretty thoroughly as real ones except for the fact that they
> appear to have size 0 yet contents can still be read.
>
> I suppose that, since the point of NO_CLOBBER is to prevent destroying
> existing file contents, redirection could be allowed to succeed for
> existing zero-sized files, which would then work for virtual files.
>
> However, that's not the way it works now, and zsh-workers would need to
> have some discussion of whether that change is acceptable.

Maybe we could add a NO_DESTRUCTIVE_CLOBBER which allows >> to
nonexisting files, > to zero sized files and possible etceteras, but
not > to nonzero files? I personally never find `>> nonexist` aborting
to be useful.

-- 
Mikael Magnusson


      reply	other threads:[~2014-11-29 20:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29  9:10 meino.cramer
2014-11-29 19:35 ` Bart Schaefer
2014-11-29 20:03   ` Mikael Magnusson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3QzGV3Cg+swu+1Uo6JocO7zVGSr6rPgaXhO_M78u6G47w@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).