1

I'm just wondering how to list Environmental Variables that would begin with something specific (say i wanted all the Environmental Variables that began with "we") in OSX. i understand how to print them all but can't work out how to search for a specific one.

Any help would be appreciated greatly!

1 Answer 1

1

You can just pipe the printenv command through grep.

printenv | grep -i "we" 

The -i flag tells grep to search case-insensitively.

Sign up to request clarification or add additional context in comments.

2 Comments

That should probably be grep -i '^we'... Otherwise you're finding variables that contain "we" instead of start with "we", and also may have "we" in the value instead of the name...
hi, i actually worked this out shortly after posting. thanks for the help, everyone.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.