Hacker News new | past | comments | ask | show | jobs | submit login

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



Let the operators take one argument?

    # 2*((10+4)/7)
    $ echo 10 | add 4 | divide-by 7 | times 2
    4


I do like that, it also makes the utility more filter-like. Here is that implemented in C: https://gist.github.com/zokier/6b43032afb248bef68b7




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: