|
Bash scripting help
So i'm trying to make a script that validates if the user input is a integer and it works but i don't know how loop the script if the input is invalid, like say they enter a "a" instead of a integer i need to be able to ask for a re-input. This is what i have so far...
#!/bin/sh
echo -n "Enter a integer: "
read x
if [ $x -eq $x 2> /dev/null ]
then
echo -e "$x is an integer"
else
echo -e "$x is not an integer"
fi
__________________
Games don't make people violent, lag does!
|