Live data from Hacker News

The Mighty Named Pipe

vincebuffalo.com

41–50 of 99 posts

Re: The Mighty Named Pipe

#41
post #9

If you like pipes, then you will love lazy evaluation. It is unfortunate, though, that Unix doesn't support that (operations can block when "writing" only, not when "nobody is reading").

If nobody is reading, you will eventually fill the pipe buffer (which is about 4k), and the writing will stop. It's a bigger queue than most of us would expect when compared to generator expressions, but it can and does create back pressure while making reads efficient.

*about 4k

64k on linux these days.

Re: The Mighty Named Pipe

#42
post #13

Earlier quoted context omitted.

man pages! $ man bash / Drops you right into the Process Substitution section.

Ahhhh..haaa...ha....DOH! I've never even thought of looking at the manpage for bash before. Thanks, you've just made my life better.

That's weird, isn't it? You wanted to know how to use a feature of bash and didn't check the manual?

Re: The Mighty Named Pipe

#43
Is this guy a bioinformatician? I think he's a bioinformatician.

Can't be sure if he is a bioinformatician because he never really mentions that he is a bioinformatician.

Re: The Mighty Named Pipe

#44

Is this guy a bioinformatician? I think he's a bioinformatician. Can't be sure if he is a bioinformatician because he never really mentions that he is a bioinformatician.

The tone made me stop reading. It reads like a child's thoughts in a comic book.

Re: The Mighty Named Pipe

#45
post #13

Earlier quoted context omitted.

man pages! $ man bash / Drops you right into the Process Substitution section.

Ahhhh..haaa...ha....DOH! I've never even thought of looking at the manpage for bash before. Thanks, you've just made my life better.

I try to read it about once a year. I always find something new before my eyes glaze over and I'm done until next year.

Re: The Mighty Named Pipe

#46
post #22

Earlier quoted context omitted.

Named pipes have been rare for me, but simple process substitution is every day. Very often I do something like this in quick succession. Command line editing makes this trivial. $ find . -name "*blarg*.cpp" # Some output that looks like what I'm looking for. # Run the same find again in a process, and grep for something. $ grep -i "blooey" $(find . -name "*blarg*.cpp") # Yep, those are the files I'm looking for, so…

That's actually command substitution, not process substitution :)

And command substitution has nothing to do with pipes, named or unnamed.

Re: The Mighty Named Pipe

#47
post #14

Pipes are very cool and useful, but it's hard for me to understand this common worship of something like that. Yes, it's useful and elegant, but is it really the best thing since Jesus Christ?

Wow. I guess that's what I get for not being totally enamoured of Unix.

Re: The Mighty Named Pipe

#48
post #9

If you like pipes, then you will love lazy evaluation. It is unfortunate, though, that Unix doesn't support that (operations can block when "writing" only, not when "nobody is reading").

Lazy evaluation with pipes would be problematic because alerts/echos would be ignored by default as they are necessarily part of the stdin/stdout chain.

I.E.: This section of code

     let a = "some_file_name".as_string();
     println!("Opening: {}", a);
     let path = std::path(a);
     let mut fd = std::io::open(path);
would get optimized to

     let mut fd = std::io::open(std::path("some_file_name".as_string()));
with strict lazy evaluation. The user feedback is removed, which is a big part of shell scripting.

Re: The Mighty Named Pipe

#49
post #47
post #14

Pipes are very cool and useful, but it's hard for me to understand this common worship of something like that. Yes, it's useful and elegant, but is it really the best thing since Jesus Christ?

Wow. I guess that's what I get for not being totally enamoured of Unix.

No, that's not why you were down voted. You were down voted because you were condescending to the people who enjoy working with *nix.

Re: The Mighty Named Pipe

#50
post #22

Earlier quoted context omitted.

Named pipes have been rare for me, but simple process substitution is every day. Very often I do something like this in quick succession. Command line editing makes this trivial. $ find . -name "*blarg*.cpp" # Some output that looks like what I'm looking for. # Run the same find again in a process, and grep for something. $ grep -i "blooey" $(find . -name "*blarg*.cpp") # Yep, those are the files I'm looking for, so…

You could just use a pipe here though, which would also make it more easy to read. e.g.: $ find . -name '*blarg*.cpp' | grep -li blooey | vi -

I used to do it something like that, but I find it personally easier to understand the way I described it and evolved into that. I also like what I'm ultimately doing (vim/vi in this case) to be over on the left: edit whatever this mess on the right produces.
Post reply on HN