From the course: Troubleshooting and Debugging Bash

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Environment variables

Environment variables - Bash Tutorial

From the course: Troubleshooting and Debugging Bash

Start my 1-month free trial

Environment variables

- [Instructor] Environment variables may be called by your script using a dollar sign, followed by any existing variable in your env output. You should use them when you need information that is defined in the environment, but it's possible for an environment variable to pass data that you don't expect. For example, another administrator could configure the environment with additional variables or change the values in the default environment system. Because your system depends on the information being correct, your script will not behave as expected if that information is modified or missing. In /user/sbin, there is an executable called env. Env, if you run it in the terminal, will reveal all configured environment variables when you issue it without a flag. Environment variables can be passed into a script by calling them. Options include but are not limited to $PWD, which is the working directory where your script is…

Contents