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

Re: zsh blocks at file truncation



Hello,

For a reason unknown with my zsh setup this:

$ > file.txt

creates a new empty file if it does not exist and complains:

zsh: file exists: file.txt

if it exists...

With this:

$ >| file.txt

I can truncate the file and write to it whatever i want like with:

$ cat > file.txt

I must have something setup in my ~/.zshrc for this to work that way, but I'm too lazy to check :D

$ >| file.txt
foo
bar
baz

will end with CTRL-D like with

$ cat > file.txt.

And if I pull what i wrote

$ > file.txt

from history it will give me

$ >| file.txt

Oh dear, what is going on? :D

On Sep 21, 2013, at 10:10 AM, chandan wrote:

> Hi all,
> 
> Like most others I am trying to move from bash to zsh as my default shell.
> 
> On zsh, Why does the following block indefinitely?
> 
> $ >file.txt
> 
> On bash, the above would truncate a file. Also, on bash 'file.txt'
> would be created if it does on exist.
> 
> After some debugging, I found that the above command blocked at the
> invocation of the 'cat' command (as provided by 'ps -c <pid>').
> 
> Thanks,
> chandan
> 



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