How do I split a string on a delimiter in Bash?

You can set the internal field separator (IFS) variable, and then let it parse into an array. When this happens in a command, then the assignment to IFS only takes place to that single command’s environment (to read ). It then parses the input according to the IFS variable value into an array, which we can then iterate over.

IN=";"IFS=';' read -ra ADDR <<< "$IN"for i in "${ADDR[@]}"; do    echo "$i"done