1 Oct
2004
1 Oct
'04
07:49
JW writes:
TAPESTATE=`mt -f /dev/st0 status | head -2 |tail -1 | cut -d " " -f4`
if [ ${TAPESTATE} == "512" ]; then READY="yes" else READY="no" && echo "No tape in oe1 tape drive" | mail -s "Oe1 tape error" jw@mailsw.com fi
A general way to test for a non-empty string is: if [ -n "${TAPESTATE}" ]; then ... fi Or its converse, to test for an empty string: if [ -z "${TAPESTATE}" ]; then ... fi See "man test". The left bracket [ is the same thing as the "test" command. -Ti