All Questions
Tagged with bash-array variable
4 questions
1
vote
2
answers
2k
views
Array Declaration: Double Quotes & Parentheses
Perhaps this is a stupid question but two hours on Google hasn't turned up anything on point.
Simply, does a difference exist in Bash between:
X="
a
b
c
"
and
X=(
a
b
c
)
The former ...
4
votes
1
answer
3k
views
Why is "${ARRAY[@]}" expanded into multiple words, when it's quoted?
I don't understand why "${ARRAY[@]}" gets expanded to multiple words, when it's quoted ("...")?
Take this example:
IFS=":" read -ra ARRAY <<< "foo:bar:baz"
for e in "${ARRAY[@]}"; do echo $...
0
votes
2
answers
996
views
For-loop - appending to arrays with iterator in the array name
I have the following problem. I have an array arr with some values. I want to sort each value into a set of different - and already declared - arrays earr$j, i.e. arr[0] into earr1, arr[1] into earr2 ...
2
votes
0
answers
289
views
for loop and appending over list of arrays
I am new to Bash scripting and presently find myself dealing with a small problem in working with for loops, arrays and variable assignment/substitution which I do not know how to solve. Since I am ...