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

Re: redirecting stdout of no/empty command



On Fri, Jan 6, 2012 at 19:43, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> 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 have the same behaviour than Isaac:

luke% zsh -f
luke% >file1
[Typing Hello, World^D^D]
luke% cat file1
Hello, World
luke%

(It's not affecting me much since when I need to have empty input, I
use cat /dev/null or echo -n "")

-- 
Damien Thebault



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