| Text-only | Table of Contents (frame/ no frame) |
| (26) Coprocesses |
|
command &
bgpid=$!
$! contains the process ID of the last background job
that was started. You can save that and examine the process later
(ps -p $bgpid) or send it a signal (kill -HUP $bgpid).
command |&
read -p var
print -p args
exec <&p
exec >&p
Example: ex9 display, text
A script wants to save a copy of all output in a file, but also wants a copy
to the screen. This is equivalent to always running the script as
script | tee outfile
Example: ex10 display, text
Start a coprocess to look up usernames in some database.
It is faster to run a single process than to run a separate
lookup for each user.
| coprocesses.src last modified Mar 11, 2005 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |