taylor / kiex

Elixir version manager
http://taylor.github.io/kiex/
MIT License
766 stars 65 forks source link

List command is not working #63

Closed zentetsukenz closed 7 years ago

zentetsukenz commented 7 years ago

kiex list command throw out an error

kiex elixirs

   elixir-1.3.3/Users/wiwattamongkhonchit/.kiex/bin/kiex: line 946: elixir-1.3.3: syntax error: invalid arithmetic operator (error token is ".3.3")

I'm not bash script expert, so I'm not sure what's going on here but looking from the error and the code it seems like

target_alias_list="${ealiases[$version]}"

array dereference is trying to evaluate $version expression which currently contain elixir-1.x.x and throw an error.

aboroska commented 7 years ago

This is caused by #61 that introduces associative arrays declare -A ealiases=() which is a Bash 4 feature. If you use Bash 3.2 (that comes with macOS Sierra for example) the problem manifests.

So kiex master is unusable on vanilla mac because Apple is reluctant to upgrade Bash due to the licensing change in Bash 4. The workaround is to upgrade Bash manually http://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx

Sidenote: Perl5 is the most portable scripting platform.

taylor commented 7 years ago

Reverted changes until this can be written to support Bash 3.2.

greymouser commented 7 years ago

@taylor gahhhhh, my bad. I already have the fix for Bash 3 here: https://github.com/greymouser/kiex/tree/unalias+delete

I'm not sure I know the correct git steps in this case; my branch doesn't have the rollback. Should I create a new branch from upstream master on my side, revert the reversion, and cherry-pick my change in? Advice appreciated.

greymouser commented 7 years ago

@taylor A new pull request against master has been created with Bash 3 support.