mardi 24 mars 2020

Why is my Bash script with grep not working?

I'm trying to understand why this very simple script is not working:

echo "SomeText" > test
if [[ "grep 'FindMe' ./test" ]] ; then
  echo Why is this line written to screen?
fi

I have tried with:

"grep 'FindMe' ./test"

$(grep 'FindMe' ./test)

`grep 'FindMe' ./test`

also with a lot of grep options.

I have tried with [] and [[]] and {} and any combination.

Aucun commentaire:

Enregistrer un commentaire