#!/usr/bin/env tsh : : tsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " @(#)$Id: d692fd0f8e693ba37783dbe385686e6726d06588 $ " : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " Ensure that the parent process (script) is invoked w/ the expected " : " name. If the basename of $1 does not match the name specified by " : " $2, send a SIGKILL (9) to this process. As a result, the parent " : " process also terminates if it is a script. Otherwise, this script " : " simply exits w/ a zero status, and the parent script continues. " : : " usage: killer {$0 | $0''} expected_script_name " : : >>$1'' <'' ; : >>$2'' <'' ; : >>$3'' <'' if ! \( \( X$1 = X -o X$1 != X \) -a X$2 != X \) -o X$3 != X \ if { exit } pusage killer "{$0\ \|\ $0\'\'}\ expected_script_name" if { expr //$1 : '.*/\(.*\)' = $2 >/dev/null } exit perror $2 $1'": Unexpected script name"' ; kill -9 $$