I don't how to use regex properly in bash, i got an error trying to do in this way, what is wrong in that regex verification?
#!/bin/bash
if [ ! $# -eq 1 ]; then
echo "Error: wrong parameters"
else
if [ $1 =~ "[a-z]" ]; then
echo "$1: word"
elif [ $1 =~ "[0-9]" ]; then
echo "$1: number"
else
echo "$1: invalid parameter"
fi
fi
case.case $1 in *[!A-Za-z0-9]*) echo invalid;; *[A-za-z]*) echo word;; '') echo empty;; *) echo number;; esac