I have a small script to demonstrate what I want to do
#!/bin/bash > z tail -f z | grep 'd' & echo $!
$! gives the PID of the grep process. I want to be able to kill the tail process at the same time as killing the grep process. Doing
kill "pid of grep"does not kill the tail process. Nor does
killall grep. I could use
killall tail but I think this would be dangerous.