Skip to content

Listing all environment variables that starts with a string #12794

Closed Answered by Jan9103
cronhan asked this question in Q&A
Discussion options

You must be logged in to vote
$env | transpose key value | where ($it.key | str starts-with 'a')

since $env is a record and not a table we first have to transpose it to one in order to make it properly iterable. -> transpose key value

and now we can use where, which filters a list/table (and it allows the use of the spicial variable $it)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by cronhan
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants