Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Whatever
how to check whether a string contains a special character or not in bash
Hsaai Tsueng
Programming language:
Whatever
2021-06-28 12:46:58
0
Q:
how to check whether a string contains a special character or not in bash
NL_Derek
Code:
Whatever
2021-09-16 02:19:45
if [[ $str =~ ['!@#$%^&*()_+'] ]]; then echo yes else echo no fi
0
Tags
string
check
con
how
character
Related
How to check a string for specific characters?
bash command to empty textfile
how to check if a string contains a character
bash replace substring
test string equality bash
New to Communities?
Join the community