Skip to main content

All Questions

3 votes
1 answer
120 views

How can i use a parameter as an inner array-name to my script?

When i write a script named array_call_self.sh as follows #!/bin/bash declare -A num word word=( [a]='index_a' [b]='index_b' [c]='index_c' ) num=( [a]=1 [b]=2 [c]=3 ) array=${$1[@]} for i in ${$...
AKA4's user avatar
  • 41
2 votes
1 answer
2k views

bash associative array where values are variables, print each value's variable name

I have the following associative array. var1="dog" var2="cat" var3="moose" declare -A asar01=( ["one"]="$var1" ["two"]="$var2" [&...
Dave's user avatar
  • 700
1 vote
1 answer
475 views

How to declare -A MYASSOCIATIVEARRY globally? [duplicate]

I have the same exact problem as described in this SO post ("bash associative array key string with colon is giving error"): https://stackoverflow.com/q/40406187/10639803 The solution is to use ...
datsb's user avatar
  • 323
0 votes
0 answers
172 views

bash: how to pass variables to a loop within a process substitution

How do you pass variable values within a process substitution to a loop within that process substitution? I'm reading a csv file into an associative array, and while reading each line, I would like ...
gj.'s user avatar
  • 11