I am using Ubuntu 11.04 and have started learning shell scripting.
Following commands do not work in shell...though have given in books and online tutorial also.
array_var=(1 2 3 4 5 6) #declaration
array_var[0]="test1" #declaration
$ echo ${array_var[0]} #printing single element of array
But extensive search gives me
my_array="a b a a c"
This is working. But now i want to print particular element of it.
exm. $echo my_array[0]
should print a
code :
#!/bin/bash
my_array="a b a a c"
echo $area[0]
echo ${area[0]}
error:
trial1.sh: 4: Bad substitution
Any help !!!!!
But as I said please do it for Ubuntu 11.04.
Is it a Bug ????
Bookmarks