Created
January 7, 2019 03:35
-
-
Save srkiNZ84/139d10e0b962a2bbc87e948142a05326 to your computer and use it in GitHub Desktop.
comma_separated_list_to_array.sh
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 | |
CITIES="Paris, Madrid, Berlin" | |
IFS=', ' read -r -a citiesArray <<< "$CITIES" | |
for city in "${citiesArray[@]}" | |
do | |
echo "City: $city" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment