How can a shell script control another script
I remember vaguely a technique using pipes f开发者_如何学Pythonor communication between two shell processes.
Are there any tutorials available on how to setup and control a subshell?
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.
Did you take a look at the Advanced Bash Scripting guide?
There's an entire chapter about - surprise surprise - subshells.
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
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
精彩评论