tags:

views:

79

answers:

4

I remember vaguely a technique using pipes for communication between two shell processes.

Are there any tutorials available on how to setup and control a subshell?

+1  A: 

Did you take a look at the Advanced Bash Scripting guide?

There's an entire chapter about - surprise surprise - subshells.

sm
@sm - thanks I knows this guide, but my problem is rather how to communicate between the processes
stacker
Sorry mate, I didn't read your question carefully enough.How about this http://www.linuxjournal.com/content/using-named-pipes-fifos-bash ?
sm
@sm that was exactly what I was looking for, thanks.
stacker
+1  A: 

This should get you going, examples are in C, but the same technique applies to bash. Just do a search for named pipes, in google or here, alot of examples specific to bash pops up.

http://developers.sun.com/solaris/articles/named_pipes.html

Anders
+2  A: 

Are you talking about named pipes?

mkfifo pipe
ls -l >pipe #type this is one shell
cat <pipe #type this is another one

No one reads if no one writes.
No one writes if no one reads.

Alberto Zaccagni
[Here's another reference](http://mywiki.wooledge.org/NamedPipes).
Dennis Williamson
+1  A: 

I think you want coprocesses. In bash 4 there is a new builtin "coproc".

See here for examples:

http://tldp.org/LDP/abs/html/bashver4.html

jim mcnamara