2 ms·
I though a pipeline would be more idiomatic way of doing this in bash. But my initial attempt resulted quite unreadable mess: $ cat <(echo 2) <(cat <(cat <
by zokier 13y ago
I though a pipeline would be more idiomatic way of doing this in bash. But my initial attempt resulted quite unreadable mess:
$ cat <(echo 2) <(cat <(cat <(echo 10) <(echo 4) | +) <(echo 7)| d) | x
4
Is there any way of making that more readable? My variation of the C utility source code is here: https://gist.github.com/zokier/c55e9c9736009981b494 https://gist.github.com/zokier/c55e9c9736009981b494
- captainmuon 13y agoLet the operators take one argument? # 2*((10+4)/7) $ echo 10 | add 4 | divide-by 7 | times 2 4
- zokier 13y agoI do like that, it also makes the utility more filter-like. Here is that implemented in C: https://gist.github.com/zokier/6b43032afb248bef68b7 https://gist.github.com/zokier/6b43032afb248bef68b7