- Joined
- Jan 3, 2006
- Messages
- 580 (0.09/day)
- Location
- Manitoba, Canada
Processor | Intel i7 3820 @ 4.3 Ghz |
---|---|
Motherboard | Asus P9 x79 Pro |
Cooling | Fans 6x 120mm, 1x 140mm, 2x 200mm |
Memory | 16GB corsair dominator platinum DDR3 1866 |
Video Card(s) | Asus GTX 670 DCII TOP 2GB |
Storage | 240GB Intel 330 SSD, 640 GB WD, 2 TB WD, 3 TB Segate GoFlex Desk USB 3.0 |
Display(s) | Samsung 19inch widescreen |
Case | Coolermaster HAF XM |
Audio Device(s) | onbored |
Power Supply | pc power and cooling 750watt |
Software | Windows 7 SP1 |
Benchmark Scores | 3D Mark 11 = P9951 http://www.3dmark.com/3dm11/4564568 |
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
#!/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