Iterate through an associative array.
Section: Associative Arrays
Loop through key/value pairs
bash
bash
for k in "${!ports[@]}"; do echo "$k=${ports[$k]}"; doneExplanation
Order is not guaranteed.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Associative Arrays