ojosVerdes
Technical User
I have the following function that should work if you enter any of the follwing paterns:
+8 -9
-9 8
9 9
-9 -8
+9 +8
0 0
I have tested it successfully with
-9 8
9 9
-9 -9
0 0
The only thing that does not accept is the + sing infront of the number.
Can anybody please help.
checkinput()
{
echo $1 | grep -Eq '^(\+|-)?[0-9]+$'
return $?
}
+8 -9
-9 8
9 9
-9 -8
+9 +8
0 0
I have tested it successfully with
-9 8
9 9
-9 -9
0 0
The only thing that does not accept is the + sing infront of the number.
Can anybody please help.
checkinput()
{
echo $1 | grep -Eq '^(\+|-)?[0-9]+$'
return $?
}