Created
December 16, 2022 07:07
-
-
Save ogii/6991d1f8b71724a20f6469d5cf7f87a6 to your computer and use it in GitHub Desktop.
Iterate through an associative array in bash
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
declare -A channels=( ["mocha1"]="channel1" ["mocha2"]="channel2" ["mocha3"]="channel3") | |
for key in "${!channels[@]}"; do | |
if [ "$key" = "<< parameters.test-name >>" ]; then | |
echo "${channels[$key]}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment