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.

Placement of variables

Placement of variables - Bash Tutorial

From the course: Troubleshooting and Debugging Bash

Start my 1-month free trial

Placement of variables

- [Narrator] Bash runs code sequentially, so it's very important to set your variables up top and call them further below in your script. A variable is a temporary store of information. There are two kinds of variables that I want to talk about here. One is an environment variable. This is information that is available to a script which can be passed through with symbols that we can use and reuse, like $user for the currently logged in user account, or $path for the path to the current user's home directory. Sometimes we write scripts that automate things that we know how to do so that we can hand those scripts over to other systems administrators without the scripting talent to do everything we have scripted. When we do this, we will define variables that the systems admiinistrator running the script, or the user of the script, can modify just prior to running it in order to create a customized experience. A script…

Contents