From d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663 Mon Sep 17 00:00:00 2001 From: sheldonh Date: Mon, 13 Sep 1999 15:44:20 +0000 Subject: Apply a consistent style to most of the etc scripts. Particularly, use case instead of test where appropriate, since case allows case is a sh builtin and (as a side-effect) allows case-insensitivity. Changes discussed on freebsd-hackers. Submitted by: Doug Barton --- etc/isdn/isdntel.sh | 61 ++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 34 deletions(-) (limited to 'etc/isdn/isdntel.sh') diff --git a/etc/isdn/isdntel.sh b/etc/isdn/isdntel.sh index d76885d..14f528a 100755 --- a/etc/isdn/isdntel.sh +++ b/etc/isdn/isdntel.sh @@ -17,9 +17,9 @@ LIBDIR=/usr/share/isdn VARDIR=/var/isdn DEVICE=/dev/i4btel0 -# sounds -MESSAGE=$LIBDIR/msg.al -BEEP=$LIBDIR/beep.al +# sounds +MESSAGE=${LIBDIR}/msg.al +BEEP=${LIBDIR}/beep.al # dd options SKIP=25 @@ -35,36 +35,32 @@ dst= DATE=`date` # check if directory exists -if [ ! -d $VARDIR ] +if [ ! -d "${VARDIR}" ] then - mkdir $VARDIR + mkdir ${VARDIR} fi # get options -set -- `/usr/bin/getopt D:d:s: $*` - -if [ $? != 0 ] -then +if ! set -- `/usr/bin/getopt D:d:s: $*`; then echo "usage2: play -D device -d -s " exit 1 fi # process options -for i -do +for i ; do case $i in - -D) - DEVICE=$2; shift; shift; - ;; - -d) - dst=$2; shift; shift; - ;; - -s) - src=$2; shift; shift; - ;; - --) - shift; break; - ;; + -D) + DEVICE=$2; shift; shift; + ;; + -d) + dst=$2; shift; shift; + ;; + -s) + src=$2; shift; shift; + ;; + --) + shift; break; + ;; esac done @@ -73,33 +69,30 @@ done FILEDATE=`date \+%y%m%d%H%M%S` # echo message to phone -if [ -f $MESSAGE ] -then - /bin/dd of=$DEVICE if=$MESSAGE bs=2k >/dev/null 2>&1 +if [ -r "${MESSAGE}" ]; then + /bin/dd of=${DEVICE} if=${MESSAGE} bs=2k >/dev/null 2>&1 fi # echo beep to phone -if [ -f $BEEP ] -then - /bin/dd of=$DEVICE if=$BEEP bs=2k >/dev/null 2>&1 +if [ -r "${BEEP}" ]; then + /bin/dd of=${DEVICE} if=${BEEP} bs=2k >/dev/null 2>&1 fi # start time START=`date \+%s` # get message from caller -/bin/dd if=$DEVICE of=$VARDIR/$FILEDATE-$dst-$src skip=$SKIP bs=2k count=$MAXMSIZ >/dev/null 2>&1 +/bin/dd if=${DEVICE} of=${VARDIR}/${FILEDATE}-${dst}-${src} skip=${SKIP} bs=2k count=${MAXMSIZ} >/dev/null 2>&1 # end time END=`date \+%s` # duration -TIME=`expr $END - $START` +TIME=`expr ${END} - ${START}` # save recorded message -if [ -f $VARDIR/$FILEDATE-$dst-$src ] -then - mv $VARDIR/$FILEDATE-$dst-$src $VARDIR/$FILEDATE-$dst-$src-$TIME +if [ -r "${VARDIR}/${FILEDATE}-${dst}-${src}" ]; then + mv ${VARDIR}/${FILEDATE}-${dst}-${src} ${VARDIR}/${FILEDATE}-${dst}-${src}-${TIME} fi exit 0 -- cgit v1.1