O'Reilly logo

Mastering Bash by Giorgio Zarrelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arrays

Think of an array as a structure that can hold more than a single object, something like a variable with one or many values. Imagine you have a few friends and you want to write down their names:

friend_1=Anthonyfriend_2=Mikefriend_3=Noelfriend_4=Tarekfriend_5=Dionysios

Once you have the variables instanced, you can then deference them, deferencing being the act of retrieving a value. This is OK, but it somehow cages you into some limitations, such as you must call the exact variable name to access its value, you cannot easily cycle between them, you cannot tell the number of values so quickly, and more. For such operations, there is an appropriate structure, which comes at hand and allows us to work on the values as a single entity--this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required