Closed CasperVector closed 7 years ago
As a side note, this seems to be consistent with the behaviour of plan9port rc
, but I personally think the behaviour itself is incorrect.
I'd have to agree. Not looking at the source at the moment but it seems like an interesting bug. Presumably this is a feature of the grammar, the second redirection applies to the pipe as a whole. Not intuitive.
; {>[2=1] ls 0} | sed s/0/1/
is what you expect.
I also consider the grammar to be the root cause. I think it's worth modifying the grammar spec (if the modification is reasonably simple) to avoid this behaviour, even if that introduces yet another incompatibility to plan9port rc
...
It's a simple enough fix, just make the precedence of a prefix redir higher than pipe. d2a398257626faf73fd7a5326b31bbc3f613e3da
Took me a little while to get there though... I've spent most of the last 10 years playing with PEGs and my CFG / LALR(1) / yacc skills are a little rusty!
I don't have a Duff rc to hand, but I can confirm that the original rc
grammar as published in the Tenth Edition manuals has the same too-low precedence for a prefix redirection.
Many thanks :)
As the title: