#!/usr/bin/env etsh : : etsh - " Force sh(1), csh(1), and other shells to exit w/ error! " <'' ;;; : : " @(#)$Id: f729a5d24a3a0ef2cbaed4399a13b5a6781e045c $ " : : " The author of this file, J.A. Neitzel , " : " hereby grants it to the public domain. " : : : " If no command-line arguments are specified, ring the terminal bell " : " according to the noted defaults. Otherwise, ring it the specified " : " count times w/ the specified delay seconds between rings. " : : " usage: bell [count=3(default) delay=0.3(default)] " : : " Check for correct usage. " : >>$0'' <'' ; killer $0 bell : >>$1'' <'' ; : >>$2'' <'' if $# = 0 if { exit } bell 3 0.3 if $# != 2 if { exit } pusage $0 '"[count=3(default) delay=0.3(default)]"' ( : " Fail if this process does not have a controlling terminal. " ) >/dev/tty if ! { if $1'' -ge 1'' } \ if { exit } perror $0 $1'": Invalid count - try an integer >= 1"' echo $2'' | egrep '^(0|0\.[0-9]+|[1-9][0-9]*|[1-9][0-9]*\.[0-9]+)$' >/dev/null if $? != 0 if { exit } perror $0 $2'": Invalid delay - try a number >= 0[.0]"' trap : 2 3 setenv ETSHDIR /tmp/bell-$$ if ! { mkdir -m 0700 $d'' } if { exit } false chdir / ; chdir $d'' ( : ) >times : RingLoop printf "%b" '\a' >/dev/tty ; echo >>times wc -l /dev/null if $? = 0 goto LoopDone sleep $2 ; goto RingLoop : LoopDone chdir - ; rm -r $d'' ; : zero status