Last active
June 30, 2016 21:20
-
-
Save d630/89d91630aa294024c91ec06ec1c0331b to your computer and use it in GitHub Desktop.
bash: Use all elements of all arrays in one for-clause; see https://forum.ubuntuusers.de/topic/verarbeitung-von-arrays/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_A=( | |
'1a' | |
'2a' | |
'3a' | |
) | |
TEST_B=( | |
'1b' | |
'2b' | |
'3b' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nr. 1 | |
source reg.txt | |
for a in "${!TEST@}" | |
do | |
# eval 'A=("${'"${_a}"'[@]}")' | |
typeset -a 'A=("${'"${a}"'[@]}")' | |
for aa in "${A[@]}" | |
do | |
echo "$aa" | |
done | |
done | |
# Nr. 2 | |
source reg.txt | |
for a in "${!TEST@}" | |
do | |
A="$a[@]" | |
for aa in "${!A}" | |
do | |
echo "$aa" | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nr. 3
(geirha in bash@freenode):