DEV Community

Discussion on: Linux Commands: printenv

Collapse
 
umesh profile image
Umesh Yadav

Hey, yes actually you can grep the output of the env and get the values or echo works as well. Most the people use what you have mentioned above and very few people are aware about printenv and how easy it is to use. That's the only reason wrote about it. Thanks for the feedback on the env blog, I will surely consinder adding more about reading a varibale.

Collapse
 
michaelcurrin profile image
Michael Currin

printenv FOO is longer to type than echo $FOO and also it is less flexible. You can't do something like echo "$FOO $BAR"

Maybe you can make an alias:

alias p=printenv
Enter fullscreen mode Exit fullscreen mode

So you can run

p FOO
Enter fullscreen mode Exit fullscreen mode