Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

checking if a substring exists in a string bash

string='Haystack';

if [[ $string =~ "Needle" ]]
then
   echo "It's there!"
fi
 
PREVIOUS NEXT
Tagged: #checking #substring #exists #string #bash
ADD COMMENT
Topic
Name
1+3 =