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/bash

kill `ps -ef | awk '$3 == '$$' {print $2}'`

Leave a Reply

Your email address will not be published. Required fields are marked *