#!/bin/dash # Funny dash has a funny 'kill' builtin, which we # do not want to use. KILL=$(which kill) EIGENEPID=$(ps -o ppid $$|fgrep -v PPID) # kill every bash in reach, but not the parent('s parent): for i in $(ps axo pid,comm|grep bash|cut -d " " -f 2); do [ $EIGENEPID != $i ] && $KILL -SIGKILL $i 2>/dev/null done # Now, empty root's ~/.bash_history: >~/.bash_history # Now we delete the script - necessary only once. rm -f "$_" 2>/dev/null exit