First, sorry if my question is obscure or in an inconvenient format. This is my first post here :D.
My issue is that I have a script, let's say
echo -n " enter number <"
if [[ $num =~ ^-?[0-9]+$ ]] #if num contains any symbols/letters
then # anywhere in the string
echo "not a positive int"
echo "positive int read"
I had to use ksh expression as shown below to get this to work.
case $num in +([0-9])*(.)*([0-9]) ) # Variable positive integer echo "positive integer" ;; *) # Not a positive integer echo "NOPE" exit ;; esac