Hi All,
I am having a little trouble with a Shell script I am writing. I would like to test input to see if it contains only numerals. I have already checked it for length, between 3 and 8 characters long. Let's say the the variable is called $value, how would I write the if statement?
if [ $value -eq +([0-9]) ] ; then
echo "The input contains only numerals"
fi
I grabbed the +([0-9]) from a historical forum posting, but it didn't quite work in this form. Does anyone know the answer. I think I might be close.
Cheers, Ravioli
I am having a little trouble with a Shell script I am writing. I would like to test input to see if it contains only numerals. I have already checked it for length, between 3 and 8 characters long. Let's say the the variable is called $value, how would I write the if statement?
if [ $value -eq +([0-9]) ] ; then
echo "The input contains only numerals"
fi
I grabbed the +([0-9]) from a historical forum posting, but it didn't quite work in this form. Does anyone know the answer. I think I might be close.
Cheers, Ravioli