Created
January 10, 2014 16:28
-
-
Save coderofsalvation/8357468 to your computer and use it in GitHub Desktop.
explodes string to array based on given delimiter
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
| # explodes string to array based on given delimiter | |
| # @param string delimitor | |
| # @param string varname | |
| # @param string input | |
| # usage: explode "," myarray "foo,bar" | |
| # echo ${myarray[@]} | |
| explode(){ | |
| IFS="$1" read -a $2 <<< "$3" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment