if [ "$1" -lt 1 ] || [ "$1" -gt 100 ]; then
echo 'error (out of range)' >&2
exit 1
fi
This assumes that the thing in $1 is actually an integer. You may verify this beforehand with
case "$1" in
("" | *[!0-9]*)
echo 'error (not a positive decimal integer number)' >&2
exit 1
esac
This will trigger the exit if $1 contains anything other than decimal digits or is empty.
Combining these:
case "$1" in
("" | *[!0-9]*)
echo 'error (not a positive decimal integer number)' >&2
exit 1
;;
*)
if [ "$1" -lt 1 ] || [ "$1" -gt 100 ]; then
echo 'error (out of range)' >&2
exit 1
fi
esac
But doing one after the other may look nicer:
case "$1" in
("" | *[!0-9]*)
echo 'error (not a positive decimal integer number)' >&2
exit 1
esac
if [ "$1" -lt 1 ] || [ "$1" -gt 100 ]; then
echo 'error (out of range)' >&2
exit 1
fi
Beware that [ arithmetic operators always consider numbers as decimal even if they start with 0, while the shell's arithmetic expansions in POSIX shells would consider numbers starting with 0 as octal (0100 is 100 for [, but 64 for $((...))).