Cleaning Up

What to do if your script needs to kill all processes that it started? Just kill everything that has same parent as your current shell ($$):

#!/bin/bashkill `ps -ef | awk '$3 == '$$' {print $2}'`