From the course: Learning Bash Scripting

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Working with variables

Working with variables - Bash Tutorial

From the course: Learning Bash Scripting

Working with variables

- [Narrator] Variables allow us to store, modify, and use values by referring to them by name. When writing scripts, we'll use variables frequently. In Bash, variables are an expression of parameter expansion, which we saw a little bit earlier. In Bash, parameters, or in this case, variables are named with alpha numeric characters, and we assign a value to that name with an equal sign followed by whatever value we want it to store. It's important to remember that there should be no space on either side of the equal sign. Variable names are case sensitive. In many cases, we'll use lowercase names for our variables. Though you can use capitalized or all caps names too. Using lowercase variables helps us to distinguish our variables from environment and system variables, which are nearly always upper case. Here in the terminal, I'll write my greeting equals hello. If we put spaces around the equal sign, we'll get an error when we…

Contents