< Previous | Contents | Next >
35 – Arrays
In the previous chapter, we looked at how the shell can manipulate strings and numbers. The data types we have looked at so far are known in computer science circles as scalar variables; that is, variables that contain a single value.
In this chapter, we will look at another kind of data structure called an array, which holds multiple values. Arrays are a feature of virtually every programming language. The shell supports them, too, though in a rather limited fashion. Even so, they can be very useful for solving some types of programming problems.
What Are Arrays?Creating An ArrayAssigning Values To An ArrayAccessing Array ElementsArray OperationsOutputting The Entire Contents Of An ArrayDetermining The Number Of Array ElementsFinding The Subscripts Used By An ArrayAdding Elements To The End Of An ArraySorting An ArrayDeleting An ArrayAssociative ArraysSumming UpFurther Reading