ऑनवर्क्स लिनक्स और विंडोज ऑनलाइन वर्कस्टेशन

प्रतीक चिन्ह

वर्कस्टेशन के लिए मुफ्त होस्टिंग ऑनलाइन

<पिछला | विषय-सूची | अगला>

एक सरणी बनाना

Array variables are named just like other खूब जोर से पीटना variables, and are created automatically when they are accessed. Here is an example:


[मुझे@लिनक्सबॉक्स ~]$ ए[1]=फू [मुझे@लिनक्सबॉक्स ~]$ echo ${a[1]} foo

[मुझे@लिनक्सबॉक्स ~]$ ए[1]=फू [मुझे@लिनक्सबॉक्स ~]$ echo ${a[1]} foo


Here we see an example of both the assignment and access of an array element. With the first command, element 1 of array a is assigned the value “foo”. The second command displays the stored value of element 1. The use of braces in the second command is re- quired to prevent the shell from attempting pathname expansion on the name of the array element.

An array can also be created with the घोषित आदेश:


[मुझे@लिनक्सबॉक्स ~]$ declare -a a

[मुझे@लिनक्सबॉक्स ~]$ declare -a a


ऊपर दिए -a option, this example of घोषित creates the array a.


OnWorks पर शीर्ष OS क्लाउड कंप्यूटिंग: