From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20384 invoked by alias); 25 Sep 2013 14:54:09 -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: 18000 Received: (qmail 10038 invoked from network); 25 Sep 2013 14:54:03 -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 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130925075417.ZM22228@torch.brasslantern.com> Date: Wed, 25 Sep 2013 07:54:17 -0700 In-reply-to: Comments: In reply to Marko Vihoma "Re: zsh blocks at file truncation" (Sep 25, 12:23pm) References: <12896374.TIKZVcXBhR@localhost.localdomain> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: zsh blocks at file truncation MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 25, 12:23pm, Marko Vihoma wrote: } } $ > file.txt } } creates a new empty file if it does not exist and complains: } } zsh: file exists: file.txt } } if it exists... 16.2.6 Input/Output ------------------- ... CLOBBER (+C, ksh: +C) Allows `>' redirection to truncate existing files, and `>>' to create files. Otherwise `>!' or `>|' must be used to truncate a file, and `>>!' or `>>|' to create a file. } I must have something setup in my ~/.zshrc for this to work that way You have not. NO_CLOBBER (+C) is the default, so setup is needed to make it NOT work that way. } And if I pull what i wrote } from history it will give me } } $ >| file.txt That's a convenience feature. The assumption is that if you failed to create the file because of NO_CLOBBER, but then you go to the trouble of recalling the history and trying it again, you probably really meant to clobber the file, so the history fixes that part for you in advance. This all derives from zsh's distant past as a shell for college students who had a tendency to accidentally destroy their homework. Zsh's special default treatment of "rm *" can be traced to the same thing. (And I'm only partly kidding here.)