bash if with regex -e code example
Example: bash regex if condition
Use following structure:
if [[ $digit =~ [0-9] ]]; then //run if a digit included in $digit string
echo "$digit is a digit"
else
echo "oops"
fi
Use following structure:
if [[ $digit =~ [0-9] ]]; then //run if a digit included in $digit string
echo "$digit is a digit"
else
echo "oops"
fi