1 Oct
2004
1 Oct
'04
00:31
if [ ${TAPESTATE}_x == "512_x" ]; then or the more modern if [ "$TAPESTATE" == "512" ]; then HTH, Jeffrey Quoting JW <jw@mailsw.com>:
Hello,
One thing I run into all the time with bash script is:
I get a script that works perfectly when every thing is right, and is supposted to aleart me when something is wrong - often bashed on whether or not a particular var says something.
But often the script fails because bash trips out over trying to test an empty var. For example:
#!/bin/sh
TAPESTATE=`mt -f /dev/st0 status | head -2 |tail -1 | cut -d " " -f4`
if [ ${TAPESTATE} == "512" ]; then [snip]
What's the proper way to do something like this?