# Bash scripting help



## nick_1992 (Nov 13, 2010)

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


----------



## nick_1992 (Nov 13, 2010)

Well cancel that, figured it out after hours....


----------



## Arel3 (Dec 12, 2010)

If you run in to this problem again? Go in to the process manager of the server and kill the bash process. With the bash process turned off you can then run your tests on whatever you're working on without it getting bashed.


----------

