also they are fast. Shell also supports arrays to input elements. In this
section, we will discuss arrays in detail.
a) definition of array
Normally arrays consist of a subscript that
defines the number of the
element along with the name of the array.
Here is the command for an array example:
example[]
b) Giving value to an array
All elements that are present in an array can be given a value using the
symbol. You can also give the value using the individual array assignment
like
as shown below
sample = “America”
You can insert any data type in arrays just like variables and the use of
arrays can be very essential when you are dealing with loops and
conditionals with complex code in it.
You can even connect both arrays to get the desired results. This scenario is
shown below for your better understanding:
sample[2] = value
Constants
As we all know already that constant means something that cannot be
changed. Constant values exist always and can
be used to explain values
like pi that have a constant numerical value. Whenever you try to change
this constant variable an error or warning will appear in front of the shell
that says this cannot be possible.
Here is an example of the constant command:
pi = 3.142 7
Namespaces
We already have discussed variables in detail and namespaces mean that
variables that are in a defined scope. These are
created for a reason that
whenever users try to create variables that are of similar type a conflict
always occurs and makes things difficult to organize.
For this exact reason, namespaces are invented
and are used to define
citations and references which can be used multiple times in a shell
interface or a shell script.
Here is an example that explains in detail about this concept:
Operators
Operators are the most important regions of a scripting language. Operators
can help to mix or change the variable values. As of the shell, programming
goes there are a lot of operators that can be used. We will discuss some of
them now in detail: