Re:For the Love of Pipes
by toxik on Tuesday January 22, 2019 @08:43AM
(#18968151)
I think it's also a grammatical wart of shell syntax. Things going into a command are usually on the left, but piping in a file goes on the right.
[ Parent
| on HN ]
Re:For the Love of Pipes
by richardwhiuk on Tuesday January 22, 2019 @08:56AM
(#18968235)
<file command | command | command
is perfectly fine.The arrow now points backwards.
Re:For the Love of Pipes
by chrisfinazzo on Tuesday January 22, 2019 @10:22AM
(#18968847)
Of course, if any of your commands prompt for input, you'll be disappointed that's not always as easy as it appears on the surface.
Does anyone have a better way to do this kind of thing?
Re:For the Love of Pipes
by milkey_mouse on Tuesday January 22, 2019 @03:27PM
(#18972108)
The standard is expect [1]. There are also libraries for many programming languages which perform a similar task, such as pexpect [2].
[1] https://core.tcl.tk/expect/index [2] https://pexpect.readthedocs.io/en/stable/
Re:For the Love of Pipes
by richardwhiuk on Tuesday January 22, 2019 @04:38PM
(#18972803)
The better solution is to change the command so it expects programatic arguments / pass command line parameters.
i.e.
prefer `apt-get install -y` over `yes | apt-get install foo`