how to check whether a string contains a special character or not in bash code example
Example: how to check whether a string contains a special character or not in bash
if [[ $str =~ ['!@#$%^&*()_+'] ]]; then
echo yes
else
echo no
fi
if [[ $str =~ ['!@#$%^&*()_+'] ]]; then
echo yes
else
echo no
fi