#!/usr/bin/env tsh : : tsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " @(#)$Id: 3965f0f289b8a34902c620ea74e1e20d7e9e5040 $ " : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " Simulate a C-like switch with if(1) and goto(1). " : : " usage: switch [-a | -b | -n | -q | -v] " : : " Check for fatal error. " : >>$0'' <'' ; : >>$1'' <'' ; killer $0 switch : " Evaluate which, if any, option is specified. " if X$1 = X-a -o \ X$1 = X-b -o \ X$1 = X-n -o X$1 = X-q -o X$1 = X-v goto $1 goto default : -a echo case label: $1 : : " Insert any number of command lines needed to accomplish the " : " desired action(s) for this option. " : goto break : -b echo case label: $1 : : " Insert any number of command lines needed to accomplish the " : " desired action(s) for this option. " : goto break : -n - fallthrough : -q - ... : -v echo case label: $1 : : " Insert any number of command lines needed to accomplish the " : " desired action(s) for the -n, -q, or -v option. " : goto break : default if X$1 != X if { exit } pusage $0 '"[-a | -b | -n | -q | -v]"' echo default label: No option specified : fallthrough : break