Split string on delimiter in Bash

# Script to split a string based on the delimiter
declare my_string
declare my_array

my_string="Ubuntu;Linux Mint;Debian;Arch;Fedora"
IFS=';' read -ra my_array <<< "$my_string"

#Print the split string
for i in "${my_array[@]}"
    echo $i

Modified from https://linuxhandbook.com/bash-split-string/

This article was updated on 2023-01-25

I'm nabeards. I'm a full stack JavaScript developer. I travel full time, a.k.a., Professional Wanderer, a.k.a., Digital Nomad.