Answers for "bash "=~" example"

0

bash "=~" example

$ [[ 45 =~ [0-9]+ ]] && echo "45 contains digits"
45 contains digits

$ [[ "hello" =~ [0-9]+ ]] && echo "hello doesnt contains digits"
$ [[ "hello" =~ [a-z]+ ]] && echo "hello contains alphabets"
hello contains alphabets
Posted by: Guest on November-02-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language