3 ms·
FWIW, one of the reasons I made https://oilshell.org https://oilshell.org sh-compatible is because it already has a very elegant answer to this problem: Pipeli
by chubot 7y ago
FWIW, one of the reasons I made https://oilshell.org https://oilshell.org sh-compatible is because it already has a very elegant answer to this problem:
Pipelines Support Vectorized, Point-Free, and Imperative Style
http://www.oilshell.org/blog/2017/01/15.html http://www.oilshell.org/blog/2017/01/15.html
You just do
myls() { ls -la | lines ... ; }
my ls | awk '$1 > 1000'
That is, a function can be TRANSPARENTLY put in a pipeline. Shell functions have stdin and stdout that compose.
The awk part isn't ideal, but I have some plans to fix that:
http://www.oilshell.org/blog/tags.html?tag=awk#awk http://www.oilshell.org/blog/tags.html?tag=awk#awk
https://github.com/oilshell/oil/wiki/Structured-Data-in-Oil https://github.com/oilshell/oil/wiki/Structured-Data-in-Oil