> does anyone of you out there know how I can make sure that I have read an
> integer rather than a string?
> echo "How many:"
> read a
case "$a" in
*[!0-9]*) echo 'not a number:' "$a" ;;
*[0-9]*) echo 'number:' "$a" ;;
'') echo 'not a number (empty):' "$a" ;;
This should work, provided that your sh understands the "[!...]" syntax
for the complement of a character class. (Some older Bourne shells don't!
In this case, you can do something similar with the expr command.)
Note that the order of the cases must not be changed: You have to check
_first_, whether $i contains a character that is not a digit, _then_
whether it contains at least one digit (i.e., that it is nonempty).
Uwe Waldmann, Max-Planck-Institut fuer Informatik
Im Stadtwald, D-W6600 Saarbruecken 1, Germany