Declaring Variables with Attributes

Let's find out how declare command sets attributes for new variables.

Here are several examples of how to declare variables with attributes. First, let’s compare integer and string variables. We execute the following two commands in the terminal:

declare -i sum=11+2
text=11+2

Run the commands discussed in this lesson in the terminal below.

Get hands-on with 1400+ tech skills courses.