From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Using the coproc command

Using the coproc command

- [Instructor] We're getting into more advanced and less commonly used things. These vary a little bit, some moderately common, some not too common at all. But they're powerful, they're handy, and you might see 'em and it's good to know about 'em. Let's start with coprocesses. A coprocess is a way to start a command in the background and you can send it input and get its results. So it's kind of interactively working with a pipe, but you don't have to do the command in a pipeline. You can start it up and it continues to run and you can send it more stuff and read the results. So you can interact with it. You don't have to restart it over and over again. We'll see some examples. It's a little bit challenging, but if you look through the examples and think about it, I think most people get it. Let's say we have a script that just reads a line and does something with it over and over again, right? So it's a while loop here. The tr command translates corresponding character. So you give…

Contents