zsh-users
 help / color / mirror / code / Atom feed
* bash command incompatibility
@ 2004-07-28  8:07 Petre Bandac
  2004-07-28  9:26 ` Peter Stephenson
  2004-07-28 11:02 ` Wayne Davison
  0 siblings, 2 replies; 4+ messages in thread
From: Petre Bandac @ 2004-07-28  8:07 UTC (permalink / raw)
  To: zsh-users

[petre@xxl]$ cat /dev/null > fetchmail.log                              
     ~
zsh: file exists: fetchmail.log
[petre@xxl]$                                                            


when using bash, this was the command to empty the log files. why
doesn't it work in zsh ?

thanks,

petre

-- 
Login: petre          			Name: Petre Bandac
Directory: /home/petre              	Shell: /usr/local/bin/zsh
On since Mon Jul 26 16:42 (EEST) on ttyv0, idle 1 day 18:19 (messages
off)
On since Wed Jul 28 09:35 (EEST) on ttyp0, idle 1:31, from gate
New mail received Mon May 24 19:09 2004 (EEST)
     Unread since Tue Feb 17 12:31 2004 (EET)
No Plan.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bash command incompatibility
  2004-07-28  8:07 bash command incompatibility Petre Bandac
@ 2004-07-28  9:26 ` Peter Stephenson
  2004-07-28 11:02 ` Wayne Davison
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2004-07-28  9:26 UTC (permalink / raw)
  To: Petre Bandac, zsh-users

Petre Bandac wrote:
> [petre@xxl]$ cat /dev/null > fetchmail.log
>      ~
> zsh: file exists: fetchmail.log
> [petre@xxl]$
>
>
> when using bash, this was the command to empty the log files. why
> doesn't it work in zsh ?

Somewhere in one of the startup scripts someone has put `setopt
noclobber'.  You need to turn it off:

unsetopt noclobber

Putting this in ~/.zshrc should be late enough to cancel it if it's in
one of the system startup scripts.

The option actually exists in bash, too, but clearly wasn't turned on.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bash command incompatibility
  2004-07-28  8:07 bash command incompatibility Petre Bandac
  2004-07-28  9:26 ` Peter Stephenson
@ 2004-07-28 11:02 ` Wayne Davison
  2004-07-28 17:10   ` Dan Nelson
  1 sibling, 1 reply; 4+ messages in thread
From: Wayne Davison @ 2004-07-28 11:02 UTC (permalink / raw)
  To: Petre Bandac; +Cc: zsh-users

On Wed, Jul 28, 2004 at 11:07:34AM +0300, Petre Bandac wrote:
> [petre@xxl]$ cat /dev/null > fetchmail.log                              

As an alternative to turning off the no_clobber option (as Peter
suggested), you can just tell zsh that you know that the file already
exists by using a '|' after the '>', like this:

    cat /dev/null >|fetchmail.log

If you enable the option hist_allow_clobber, then any time you get a
"file exists" error, you can just recall the command from the history
and press Enter because the '|' will have been added for you.

Finally, you can avoid the problem all together by using cp:

    cp /dev/null fetchmail.log

That works in any shell and is easier to type.

..wayne..


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bash command incompatibility
  2004-07-28 11:02 ` Wayne Davison
@ 2004-07-28 17:10   ` Dan Nelson
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Nelson @ 2004-07-28 17:10 UTC (permalink / raw)
  To: Wayne Davison; +Cc: Petre Bandac, zsh-users

In the last episode (Jul 28), Wayne Davison said:
> On Wed, Jul 28, 2004 at 11:07:34AM +0300, Petre Bandac wrote:
> > [petre@xxl]$ cat /dev/null > fetchmail.log                              
> 
> As an alternative to turning off the no_clobber option (as Peter
> suggested), you can just tell zsh that you know that the file already
> exists by using a '|' after the '>', like this:
> 
>     cat /dev/null >|fetchmail.log

I prefer the ! syntax, since | means "pipe" to me, and vi also uses ! as a
"force" flag.

-- 
	Dan Nelson
	dnelson@allantgroup.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-28 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28  8:07 bash command incompatibility Petre Bandac
2004-07-28  9:26 ` Peter Stephenson
2004-07-28 11:02 ` Wayne Davison
2004-07-28 17:10   ` Dan Nelson

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).