If you are using asdf-direnv with asdf-elixir and try to execute
the command asdf direnv shell elixir $version -- echo "hi" will raise
the error "unbound variable" because the direnv uses set -u by
default.
I got this error when I tried to setup this hook on ~/.asdfrc to always
install the local.hex and local.rebar:
The hack is: always use an empty string when the variable is not defined.
Besides, it is possible to add a set +u at the beginning of the file and set -u
at the end, but set set -u at the end can cause an unexpected side
effect for another script.
If you are using asdf-direnv with asdf-elixir and try to execute the command
asdf direnv shell elixir $version -- echo "hi"
will raise the error "unbound variable" because thedirenv
usesset -u
by default.I got this error when I tried to setup this hook on
~/.asdfrc
to always install thelocal.hex
andlocal.rebar
:The hack is: always use an empty string when the variable is not defined.
Besides, it is possible to add a
set +u
at the beginning of the file andset -u
at the end, but setset -u
at the end can cause an unexpected side effect for another script.