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 :)
The Mighty Named Pipe
51–60 of 99 posts
Re: The Mighty Named Pipe
#52Earlier quoted context omitted.
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
#53If 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 evalua…
I guess an OS should be functional at its interface to the user, and only imperative deep down to keep things running efficiently.
However, note that this hypothetical functional layer on top also would ensure efficiency, as it enables lazy evaluation. This type of efficiency could under certain circumstances be even more valuable than the bare-metal performance of system programming languages.
Re: The Mighty Named Pipe
#54Earlier quoted context omitted.
> # gawk doesn't care if it's given a regular file or the output fd of some process: Something wonderful I found out the other day: Bash executes scripts as it parses them, so you can do all kinds of awful things. For starters, bash will have bash execute an infinite script that looks like echo hello echo hello echo hello ... without trying to load the whole thing first. After that, you can move onto having a script…
That's actually one of the things that I really dislike with bash, that it doesn't read the whole script before executing it. I've been bitten by it before, when I write some long-running script, then e.g. write a comment at the top of it as it's running, and then when bash looks for the next command, it's shifted a bit and I get (at best) a syntax error and have to re-run :-(
Re: The Mighty Named Pipe
#55Earlier quoted context omitted.
That's weird, isn't it? You wanted to know how to use a feature of bash and didn't check the manual?
Do you expect `man python` to output the full reference for the Python programming language?
Re: The Mighty Named Pipe
#56Is 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
#57pee: tee standard input to pipes sponge: soak up standard input and write to a file ts: timestamp standard input vipe: insert a text editor into a pipe
Re: The Mighty Named Pipe
#58Earlier quoted context omitted.
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 evalua…
I guess you found another issue with Unix. The user does not care in general how something is performed, just that it is performed correctly and with good performance. I guess an OS should be functional at its interface to the user, and only imperative deep down to keep things running efficiently. However, note that this hypothetical functional layer on top also would ensure efficiency, as it enables lazy evaluation.…
This is the crux of the matter. With BASH scripting the user does care how a task is preformed as that task maybe system administration, involve sensitive system components, OR sensitive data.
Lazy evaluation is great for binary/cpu level optimization. But passing system administration tasks though the same process is scary as you lose the 1:1 mapping you previously had.
Re: The Mighty Named Pipe
#59Earlier quoted context omitted.
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.
I have honestly been questioning my own understanding of pipe, since I've failed to see the significance before; first I thought it was just `a | b` as in "first do a, then b". So then it just seemed like a notational way of composing programs. Then I thought, uh, ok say what? Composing things is the oldest trick in the conceptual book. But then I read more about it and saw that it had this underlying wiring of standard input and output and forking processes that made me realize that I had underestimated it. So, given that, I was wondering if there is even more that I've been missing.
I have for that matter read about named pipes before and tried it out a bit. It's definitely a cool concept.