dimanche 25 juin 2023

use grep to find an entry in the $PATH variable

I have found many answers to using grep to search for the value in a variable within the contents of a file but not finding a particluar string in the actual contents of the $PATH variable. I'm on a mac and was trying to determine if "brew" was in my PATH and thought surely I can just use grep to do this... and I'm sure it's possible but nothing I've tried works so can someone please enlighten me? The following was what I thought would work but it just lists the contents of the PATH variable.

grep brew "${PATH}"

I also tried

grep brew -- "${PATH}"

which just did the same thing. What am I missing?

Aucun commentaire:

Enregistrer un commentaire