mercredi 11 février 2015

bash wildcard with variables inside an if statement

I want to find substring in a string according to this solution.


But for some reason it doesn't work with variables:



str="abcd";
substr="abc";
if [[ "${substr}"* == ${str} ]]
then
echo "CONTAINS!";
fi

Aucun commentaire:

Enregistrer un commentaire