From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27100 invoked by alias); 29 Nov 2014 20:03:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19468 Received: (qmail 13032 invoked from network); 29 Nov 2014 20:03:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=rbIl1Wdxtgp5QGnhlG0VsjFplse7TSDzG9XIWAIyyEI=; b=xQ+ag7zFrzSKKOYOheKOmB96bO7kkqiYv3cNRqSMymX7sIhIZ8NV8PbMG5vaA/BNSO FJ3sBOf2y2/11ye8borzaWuhaHCEv0vndrWZM/e/Lmii1YLBe2upBqewl2g1kd/hEljj 0X/jE6LYNPen+xBpTdEj5iU9WQuC8itN4aJ4ryYhP+KW9Ece66soaBqiKCOuoLAucMnP Tnf5ll6Sy+lCyEEoQn3jnszTgqbYFHZSKLZAIpkjfbRRHghjbC7s+x8zI8e9Zj6m7yCN X92UBD57uRFOSCAsIAR0dyeg+H3hDZ0+zOznVtJ4L/4fa/pr+Cs1z/pfL+Ex4YvnWfeZ Ub/A== MIME-Version: 1.0 X-Received: by 10.50.67.113 with SMTP id m17mr19247034igt.4.1417291387876; Sat, 29 Nov 2014 12:03:07 -0800 (PST) In-Reply-To: <141129113521.ZM1621@torch.brasslantern.com> References: <20141129091049.GF4729@solfire> <141129113521.ZM1621@torch.brasslantern.com> Date: Sat, 29 Nov 2014 21:03:07 +0100 Message-ID: Subject: Re: Using Zsh on a embedded system to configure GPIOs From: Mikael Magnusson To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On Sat, Nov 29, 2014 at 8:35 PM, Bart Schaefer 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