昨日からfishシェルを使い始めまして、anyenvの設定を ~/.config/fish/config.fish
に記述しました。
set -x PATH $HOME/.anyenv/bin $PATH
eval (anyenv init - fish)
そしてfishを起動すると、以下のエラーがでました。
Variables cannot be bracketed. In fish, please use "$PATH".
- (line 1): begin; source "/home/vagrant/.anyenv/libexec/../completions/anyenv.fish" function anyenv set command $argv[1] set -e argv[1] command anyenv "$command" $argv end set -x GOENV_ROOT "/home/vagrant/.anyenv/envs/goenv" set -x PATH $PATH "/home/vagrant/.anyenv/envs/goenv/bin" export PATH="/home/vagrant/.anyenv/envs/goenv/shims:${PATH}" goenv rehash 2>/dev/null set -x NDENV_ROOT "/home/vagrant/.anyenv/envs/ndenv" set -x PATH $PATH "/home/vagrant/.anyenv/envs/ndenv/bin" ndenv rehash 2>/dev/null ndenv() { typeset command command="$1" if [ "$#" -gt 0 ]; then shift fi case "$command" in rehash|shell) eval "`ndenv "sh-$command" "$@"`";; *) command ndenv "$command" "$@";; esac } set -x PYENV_ROOT "/home/vagrant/.anyenv/envs/pyenv" set -x PATH $PATH "/home/vagrant/.anyenv/envs/pyenv/bin" setenv PATH '/home/vagrant/.anyenv/envs/pyenv/shims' $PATH setenv PYENV_SHELL fish . '/home/vagrant/.anyenv/envs/pyenv/libexec/../completions/pyenv.fish' command pyenv rehash 2>/dev/null function pyenv set command $argv[1] set -e argv[1] switch "$command" case rehash shell . (pyenv "sh-$command" $argv|psub) case '*' command pyenv "$command" $argv end end set -x RBENV_ROOT "/home/vagrant/.anyenv/envs/rbenv" set -x PATH $PATH "/home/vagrant/.anyenv/envs/rbenv/bin" setenv PATH '/home/vagrant/.anyenv/envs/rbenv/shims' $PATH setenv RBENV_SHELL fish source '/home/vagrant/.anyenv/envs/rbenv/libexec/../completions/rbenv.fish' command rbenv rehash 2>/dev/null function rbenv set command $argv[1] set -e argv[1] switch "$command" case rehash shell source (rbenv "sh-$command" $argv|psub) case '*' command rbenv "$command" $argv end end
^
from sourcing file -
called on line 60 of file /usr/local/share/fish/functions/eval.fish
in function “eval”
called on line 15 of file ~/.config/fish/config.fish
from sourcing file ~/.config/fish/config.fish
called during startup
source: Error while reading file “-”
エラー内容をググってもどうにもならなかったので、config.fishのeval
部分をanenv init - fish
で表示される内容に変えてみました。
set -x PATH $HOME/.anyenv/bin $PATH
# anyenv init - fish で出てくる内容
source "/home/vagrant/.anyenv/libexec/../completions/anyenv.fish"
function anyenv
set command $argv[1]
set -e argv[1]
command anyenv "$command" $argv
end
set -x GOENV_ROOT "/home/vagrant/.anyenv/envs/goenv"
set -x PATH $PATH "/home/vagrant/.anyenv/envs/goenv/bin"
export PATH="/home/vagrant/.anyenv/envs/goenv/shims:${PATH}"
goenv rehash 2>/dev/null
set -x NDENV_ROOT "/home/vagrant/.anyenv/envs/ndenv"
set -x PATH $PATH "/home/vagrant/.anyenv/envs/ndenv/bin"
export PATH="/home/vagrant/.anyenv/envs/ndenv/shims:${PATH}"
ndenv rehash 2>/dev/null
ndenv() {
typeset command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "`ndenv "sh-$command" "$@"`";;
*)
command ndenv "$command" "$@";;
esac
}
set -x PYENV_ROOT "/home/vagrant/.anyenv/envs/pyenv"
set -x PATH $PATH "/home/vagrant/.anyenv/envs/pyenv/bin"
setenv PATH '/home/vagrant/.anyenv/envs/pyenv/shims' $PATH
setenv PYENV_SHELL fish
. '/home/vagrant/.anyenv/envs/pyenv/libexec/../completions/pyenv.fish'
command pyenv rehash 2>/dev/null
function pyenv
set command $argv[1]
set -e argv[1]
switch "$command"
case rehash shell
. (pyenv "sh-$command" $argv|psub)
case '*'
command pyenv "$command" $argv
end
end
set -x RBENV_ROOT "/home/vagrant/.anyenv/envs/rbenv"
set -x PATH $PATH "/home/vagrant/.anyenv/envs/rbenv/bin"
setenv PATH '/home/vagrant/.anyenv/envs/rbenv/shims' $PATH
setenv RBENV_SHELL fish
source '/home/vagrant/.anyenv/envs/rbenv/libexec/../completions/rbenv.fish'
command rbenv rehash 2>/dev/null
function rbenv
set command $argv[1]
set -e argv[1]
switch "$command"
case rehash shell
source (rbenv "sh-$command" $argv|psub)
case '*'
command rbenv "$command" $argv
end
end
こうしてfishを起動しても、また以下のエラーが出ます。どのように対応すれば良いのでしょうか?
'case' builtin not inside of switch block
~/.config/fish/config.fish (line 43): case "$command" in
^
from sourcing file ~/.config/fish/config.fish
called during startup
source: Error while reading file “/home/vagrant/.config/fish/config.fish”
ちなみにanyenvは最新バージョンにアップデートしてあります。
よろしくお願い致します。
config.fish
の中で、export PATH="/home/vagrant/.anyenv/envs/goenv/shims:${PATH}"
としている部分があり、${PATH}
を$PATH
に修正しなさい、と読めます。