I know the first and second statements evaluate correctly by themselves, but I would like to combine the two into one line (using -a or &&) as opposed to having nested if statements.
Code:
#!/bin/bash
if [[ ! -z $1 ] && [[ $1 =~ [0-9] ]]]; then
echo "$1 is a number"
else
echo "invalid arguments"
exit 1
fi
exit 0
On a side note, what are the boolean values for true and false in bash?
returns true
returns true
Code:
if [ false -a false ]
returns true
gives me a syntax error