Store and Use Values with Bash Variables

Share this video with your friends

Send Tweet

Bash, like any programming language, can set and unset variables. Global environment variables also play a big role in bash scripting. In this lesson, we'll learn how to declare and use variables, export them to other processes spawned from our current shell, and go through a quick example of how to leverage them in a script.

infoalberghi
infoalberghi
~ 5 years ago

When you use the global variable $PWD on minute 3:10, is it the same of doing $(pwd) ?

Cameron Nokes
Cameron Nokes(instructor)
~ 5 years ago

Good question. I usually favor the $PWD variable but figured they were the same. It looks like there's some differences between the two though: https://stackoverflow.com/questions/10795014/pwd-vs-pwd-regarding-portability