On Mar 19 20:02, uzibalqa (uzibalqa@proton.me) wrote:
> Have done
>
> ("-n"+[[:digit:]])
>
> But there is something wrong with it.
Parentheses in the wrong place. Try this:
shopt -s extglob
case "$1" in
-n+([[:digit:]])) echo ok;;
esac
If you want to do it without extglob, you can do something
like this:
case "$1" in
-n*[^[:digit:]]*) echo bad;;
-n[[:digit:]]*) echo ok;;
esac
I.e., first exclude cases with non-digits, then require
at least one digit.
--
Tapani Tarvainen