logoalt Hacker News

mesrik • today at 2:41 PM • 1 reply • view on HN

So would you like to write shell commands connected with pipes like that too?

So is this better too

  $ less | find / -type f -perm /6000 -ls
than ?

  $ find / -type f -perm /6000 -ls | less
Just because shell actually starts executables right to left when using pipes. Reason to this behaviour is because it can fail early if there is problem constructing pipe first and not spend lot of time something finding later that some pipe components can't start and receive data properly.

ps. I'm fine with current notation and would not like change it.


Replies

unilynx • today at 3:15 PM

I think he actually wants pipes. Instead of having to write:

  f3(f2(f1(some data)))
it would be nice to write

  some data |> f1 |> f2 |> f3
javascript has proposals for pipe operators because as soon as the simple .map /.filter/.reduce APIs don't suffice (ie. as soon as Promise.all is needed) the f3(f2(f1(data))) mess starts.
➕ show 1 reply