Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zsh blocks at file truncation
- X-seq: zsh-users 17988
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: chandan <chandanrmail@xxxxxxxxx>
- Subject: Re: zsh blocks at file truncation
- Date: Sat, 21 Sep 2013 00:53:11 -0700
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201210; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=wjDdcMziz6HHsLmmxoLRytzUj+1l15nXDQi257w36Dc=; b=VPuOR+VDXRaF2FSmI6FKyjCxxsjp7nSKvY01aopkOW/781iWTgYEnFKu5/bFUUrno3i3ZgGQps/1N3yFNlj87PZmHlhOt/IIQ8nxvK0DqlJfigeGZS+doWDNCfo8/cPpv8MjLen1SWDYRiaSgA0iPWC4/Q+JE2CJ0xk0dwnNGZc=;
- In-reply-to: <12896374.TIKZVcXBhR@localhost.localdomain>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: chandan <chandanrmail@xxxxxxxxx>, zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/0x3903637F.asc
- References: <12896374.TIKZVcXBhR@localhost.localdomain>
On 2013-09-21 at 12:40 +0530, chandan wrote:
> On zsh, Why does the following block indefinitely?
>
> $ >file.txt
That's a bare redirection, which means that you're invoking the empty
command. In bash, that invokes ":", also known as "true". By
_default_, in zsh, that's "cat" for writing and "more" for reading.
See "REDIRECTIONS WITH NO COMMAND" in zshmisc(1) [or zshall(1)].
So you can either:
setopt sh_nullcmd
or set:
NULLCMD=: READNULLCMD=:
to get the behaviour which you're used to.
For myself, I very often invoke:
% >/dev/null
to get a scratch space for fast notes which I don't want to live in
editor swap files, or testing input echo'ing in a terminal without
having a program other than the kernel and the terminal emulator try to
interpret the keystrokes.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author