lundi 3 mai 2021

Need operator like grep in If else in bash

How can I measure when a string contains my word...

I just want if character "Amit" to come in the VAR, I print "Its Amit"... i.e. I know operator like == but I don't know what is for like "grep"

VAR="hello Amit"

if [[ $VAR == Amit ]]
then
  echo "Its Amit"
else
  echo "Its not Amit"
fi

Aucun commentaire:

Enregistrer un commentaire