Search⌘ K
AI Features

Classification of Variables

Explore the classification of variables and parameters in Bash programming. Understand different types such as user-defined, internal, special parameters, and their scopes. Learn how to declare strings, integers, indexed and associative arrays, plus constants and modifiable variables to effectively manage data in your scripts.

We'll cover the following...

Attributes for classifying variables

The Bash interpreter has two operation modes: interactive (shell) and non-interactive (scripting). Variables solve similar tasks in each mode. However, the contexts of these tasks are different. Therefore, there are more features to classify variables in Bash than in other languages.

Let’s simplify the terminology for convenience. It’s not entirely correct, but it helps avoid confusion. When we talk about scripts, we use the “variable” term. When we talk about shell and command-line arguments, we use the “parameter” term. These terms are often used synonymously.

Attributes for classifying variables

There are four attributes for classifying variables in Bash. The following table explains them.

Classification Attribute
...