foo & pid_foo=$!
bar & pid_bar=$!
wait $pid_foo
kill $pid_bar
But perhaps you could just run foo | bar (if that happens to work with stdin/stdout handling).
                  ndim
                   2010-04-22 21:24:05
                
              foo & pid_foo=$!
bar & pid_bar=$!
wait $pid_foo
kill $pid_bar
But perhaps you could just run foo | bar (if that happens to work with stdin/stdout handling).
#!/bin/bash 
#enable job control in script
set -m
producer &
consumer &
fg %1
kill %2