Created
November 1, 2019 10:21
-
-
Save odellt/f0cab0d0df51dfebec35e02e6b8a8d77 to your computer and use it in GitHub Desktop.
Splits a comma delimited string into an array
This file contains hidden or 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
#!/bin/bash | |
# | |
# Script to split a string based on the delimiter | |
input_string=$1 | |
IFS=$2 read -ra string_split <<< "$input_string" | |
#Print the split string | |
for i in "${string_split[@]}" | |
do | |
echo "|$i|" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment