Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to check whether a string contains a special character or not in bash

if [[ $str =~ ['!@#$%^&*()_+'] ]]; then
    echo yes
else
    echo no
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #string #special #character #bash
ADD COMMENT
Topic
Name
9+6 =