I would like to do the following in shell scripting:
if [ (is_number $arg1) -ne 0 ] || [ (is_number $arg2) -ne 0 ] ; then
printf "Exit. Valid input must be positive integer.\n"
return 1
fi
But it gave me syntax error. Do you have better solution? Thanks!
I want a solution without accessing $?
or storing return value into variable, unless such answer doesn't exist.
I see you guys taking advantage of 0 and not 0. It make sense since 0 signify whether succeed or not.
Now, speaking it in a pure syntax way, I want to do the following:
if [ (is_number $arg1) -ne int ] || [ (is_number $arg2) -ne int] ; then
printf "Exit. Valid input must be positive integer.\n"
return 1
fi
Please provide a way, thanks.