Sometimes you want to have dynamic array names to simplify code. Below is one way of making the array name dynamic in a loop.
#!/bin/bash
section1=( fs-01 fs-02)section2=( fs-03)
function snap() { tag=$1 echo echo "TAG: $tag" x=$tag var=$x[@] for f in "${!var}" do echo "fss: $f" done}
snap "section1"snap "section2"And output like this.
TAG: section1fss: fs-01fss: fs-02
TAG: section2fss: fs-03