Korn Shell - Test with variable that may be not set
- by C. Ross
I have the following code in KornShell
FAILURE=1
SUCCESS=0
isNumeric(){
if [ -n "$1" ]; then
case $1 in
*[!0-9]* | "") return $FAILURE;
* ) return $SUCCESS;
esac;
else
return $FAILURE;
fi;
}
#...
FILE_EXT=${FILE#*.}
if [ isNumeric ${FILE_EXT} ]; then
echo "Numbered…