How to store elements to an array in bash

arrays, bash, store

Solution

Line 5 should probably read as:

read array[$i]

`${array[$i]}`, which is what you have at present, will output the value of the element of the array with the subscript $i. The `read` command reads user input into a specified variable, so you need to specify the variable name.

Problem

I got again tiny problem I would like to store strings in array I got following code: ``` echo -e "Enter an amount" read n for ((i=0;i<n;i++)); do echo "Enter number $i " read ${array[$i]} done echo -e "$array[@]}" ``` Can you have a quick look a help me ? Thanks

Original source