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

Re: Bug? piping ls to anonymous function changes subsequent behaviour of ls





On Monday, September 28, 2020, 01:41:10 AM GMT+1, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

>Not reproducible for me with "zsh -f".

>Have you tried running "whence -a ls" to find out if or to what it has
>been redefined?

Yep, it was aliased, but that isn't the problem. I've found that the anonymous function is being assigned to the left hand side of the pipe, but only the first time that pipeline is run in a new shell. Very strange.

From a new shell:
> which -a ls
ls: aliased to ls --color=auto
/bin/ls
> /bin/ls | () {echo foo}
foo
> /bin/ls
foo
> which /bin/ls
/bin/ls () {
echo foo
}
> unfunction /bin/ls
> /bin/ls
Downloads Documents etc...
> # Yay! now try again in the same shell:
> /bin/ls | () {echo foo}
foo
> /bin/ls
Downloads Documents etc...
> # back to normal behaviour!

If I start a new shell the same thing happens again, i.e. the first time I pipe to the anonymous function it is actually assigned to the left hand side, but subsequently it isn't.


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