5 ms·
Your second form can be `<somefile foo | bar | baz` which preserves the order of your first example. And `<somefile` on it's own behaves as `cat somefile` (in
by seniorsassycat 6y ago
Your second form can be `<somefile foo | bar | baz` which preserves the order of your first example. And `<somefile` on it's own behaves as `cat somefile` (in my shell atleast).
- dllthomas 6y ago> And `<somefile` on it's own behaves as `cat somefile` (in my shell atleast). zsh? It doesn't work in sh, bash, csh, tcsh, or fish.
- JNRowe 6y agoOne of the zsh options which changes this behaviour is called CSH_NULLCMD, which seems to suggest it is possible to be csh compatible in zsh. $ setopt cshnullcmd $ < task >task2 zsh: redirection with no command `man zshmisc` and search for "REDIRECTIONS WITH NO COMMAND" for all the gory details :/ Edit: inverted csh compat logic in my head :(
- shakna 6y agoIn 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.