Skip to content

Instantly share code, notes, and snippets.

@willgarcia
Last active August 29, 2015 14:07
Show Gist options
  • Save willgarcia/a3cd9b8a322bead5d7c4 to your computer and use it in GitHub Desktop.
Save willgarcia/a3cd9b8a322bead5d7c4 to your computer and use it in GitHub Desktop.
bash arrays
[ $count -gt 0 && $someVar != $var] # double condition
if myfunc && [ ... ] # function condition
# explode on ","
function explode(){
local types=$1
array=(${types//,/ })
for type in $(echo $types | tr "," "\n") do
echo ${type[i]}
done
# or for type in $(echo $types | tr "," "\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment