vendredi 18 mars 2016

How can i check if $varA contains $varB?

I have a variable $user and $remotequota. $user contains a string and $remotequota is a file located on the disk.

I want to check if the string $user is also in the file which is stored in $remotequota

Have tried it with several versions of if grep -q $user "$remotequota" and also with if grep -q $user <<<$remotequota

The strange thing is that sometimes i get the results i want (have double-checked) and then i don't. This is driving me crayz

Is there a better way to check a if $varA contains $varB?

thanks a lot in advance

Aucun commentaire:

Enregistrer un commentaire