S
S
Sergey Titov2015-09-30 03:04:40
linux
Sergey Titov, 2015-09-30 03:04:40

How to list the environment variables set for the current session (without including variable values ​​in this list)?

As I understand it, the list itself is issued by the env command, but it produces the form name = value, but how to display it without value, only name?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly Egorov, 2015-09-30
@Nuboskill

env|cut -d'=' -f1
Read more:
| - pipeline transfer
cut - output fields
-d'=' - set field separator
-f1 - output the first field (i.e. the one before the = sign)

H
Hanggard, 2015-10-08
@Hanggard

env | awk -F"=" '{print $1}'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question