...

/

Content Type: Variable Attributes

Content Type: Variable Attributes

Learn how variable attributes work in Bash.

We'll cover the following...

Attributes

The Bash language does not have a type system. It stores all scalar variables in memory as strings. At the same time, Bash has arrays. They are composite types, because an array is a combination of strings.

When we declare a variable in Bash, we should choose if it is scalar or composite. We make this choice by specifying the metadata for the variable. Such metadata is called attributes. The attributes also define the constancy and scope of a variable.

The declare Bash built-in specifies the variable attributes. When we call it without parameters, declare prints all local and environment variables. The ...