Hacker News new | ask | show | jobs
by isityettime 11 days ago
All of this depends on your specific shell and its parser. Fish doesn't let you put redirections at the beginning like that (though I wish it did), while GNU Bash does.
1 comments

fish is not POSIX-compatible, and not Bourne-compatible, so I don't see how that really matters at all. I used the rc shell from plan9 for quite a while, and I wouldn't expect its syntax rules to match, either!
It's worth noting because the redirections and their syntax are nonetheless otherwise shared. I don't think POSIX compatibility for shells is that important tbf. The heart of a Unix shell has little to do with POSIX syntax.
I would say that if you can't use the same redirection syntax as Bourne/Bash, then the syntax rules aren't "shared".

And that is because fish isn't POSIX-compliant. It's like when translating languages, some words are cognate, but some are "false friends" and while they look the same, they don't mean the same thing. So when using redirections in fish, the rules may be similar up to a point, but only up to a point.