From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5280 invoked by alias); 29 Nov 2014 19:36:24 -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: 19467 Received: (qmail 24005 invoked from network); 29 Nov 2014 19:36:22 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=F/vgrRlI c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=5y4faFyK3SkA:10 a=Kv6wTefEtnKUPadzf34A:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141129113521.ZM1621@torch.brasslantern.com> Date: Sat, 29 Nov 2014 11:35:21 -0800 In-reply-to: <20141129091049.GF4729@solfire> Comments: In reply to meino.cramer@gmx.de "Using Zsh on a embedded system to configure GPIOs" (Nov 29, 10:10am) References: <20141129091049.GF4729@solfire> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Using Zsh on a embedded system to configure GPIOs MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.