Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: redirecting stdout of no/empty command



Isaac Huang wrote on Fri, Jan 06, 2012 at 11:34:26 -0700:
> Hi list,
> 
> I noticed a zsh behaviour today. If I tried to run '>/dev/null' (i.e.
> stdout redirection of no command at all) on an interactive zsh, the
> zsh would actually run a 'cat', and it wouldn't exit until a ^D or ^C.
> 
> The same thing on bash seemed to be a no-op.

Actually it truncates the file.

$ echo foo>1
$ >1
$ cat 1
$ 

> I wonder why zsh would
> run 'cat' when it was given no command to run at all.
> 

As a shorthand.

See also NULLCMD and READNULLCMD in zshall(1).

> Please CC me as I'm not on the list. Thanks.
> 
> - Isaac



Messages sorted by: Reverse Date, Date, Thread, Author