mercredi 28 novembre 2018

How to check if the variable contains the same string as a file?

My variables name is A and my files name is dogs.txt . I need to check if the variables text is the same as dogs.txt (contains the same string). What is the best way to do it?

I tried this

if [ cat dogs.txt == "$A" ] ; then  echo "equal" ; fi

Aucun commentaire:

Enregistrer un commentaire