Answers for "bash file contains a variable"

5

check if variable contains string bash

STRING='Hello world'
if [[ $STRING =~ "Hello" ]] ; then echo "It's here" ; fi
Posted by: Guest on April-17-2021
0

bash if file contains string

if grep -q SomeString "$File"; then
  Some Actions # SomeString was found
fi
Posted by: Guest on March-24-2020

Code answers related to "bash file contains a variable"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language