What are Variables?

Learn why and when you need variables.

We'll cover the following

We already came across Bash variables several times in this course. We learned the list of system paths in the PATH variable. Then, we used positional parameters in the backup script. It’s time to get a good grasp on this topic.

Variable definition

Let’s start with the meaning of “variable” in programming. A variable is an area of memory where some value is stored. In most cases, this is short-term memory (RAM, CPU cache, and registers).

The first generation of programming languages—for example, assembler—has minimal support of variables. When we use such a language, we should refer to a variable by its address. If we want to read or write its value, we have to specify its memory address.

Get hands-on with 1200+ tech skills courses.