Array in Linux Programming

a shell variable is capable enough to hold single or multiple values.shell supports a different type of variable called "array variable" to store multiple values at the same time with giving a single name to variable.

Declare an Array


declare -a [ ARRAY_NAME ]
							

Defining Array Value


Array_Name [ Index ] = Value
							

Example


declare -a myarray

myarray[0] = 'Virtualhax Inc.'
myarray[1] = 'Veewom Technology'
myarray[2] =  'Quizer Studio'

echo ${myarray[0]}

#Output
#Virtualhax Inc.
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!