Answers for "bash if euqal sting or string"

3

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
1

bash if var equals string

source=""
samples=("")
if [ $1 = "country" ]; then
   source="country"
   samples="US Canada Mexico..."
else
  echo "try again"
fi
Posted by: Guest on April-09-2021

Browse Popular Code Answers by Language