5 ms·
In short, you seem to be right. Whilst fish will complain and tell you that it wants a command and not a redirection first, it should work in POSIX shells.
by shakna 6y ago
In short, you seem to be right.
Whilst fish will complain and tell you that it wants a command and not a redirection first, it should work in POSIX shells.
sh -c '< tmp.c tail'
Testing the above command it works:
With Busybox 1.31.0. (Probably the least compliant.)
GNU bash, version 5.0.16.
However, dropping the command that is being passed to, doesn't result in output to stdout. Redirecting stdin to stdout doesn't seem to work either, but I'm not sure that redirecting stdin is all that well defined.
- dllthomas 6y agoRedirection is dup2, opening files first where relevant. If all you do is open files and dup around descriptors, no file contents actually go anywhere.