`Fish` 会改变 $PATH 的顺序吗?如何避免这种情况
Does `Fish` change the order of $PATH? How to avoid that
fish --version
> fish, version 3.0.2
uname -a
> Darwin Jerrys-MacBook.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
echo $TERM
> xterm-256color
我在bash和fish
shell中比较了我的$PATH,rvm
的顺序改变了,这导致which pod
变得不同(i使用 rvm
来管理 ruby
)。
我怎样才能使它们的顺序相同?
顺便说一句,
- 我已将所有设置包含在
.bashrc
中,并通过 source ~/.bashrc
在 .bash_profile
中加载它,并在 .prfile
中注明
- 我什么都没有
~/.config/fish/config.fish
x
、~
、=
、>
的开头字符我加了标记方便比较
----- echo $PATH
=:~/.rvm/gems/ruby-2.2.9/bin
=:~/.rvm/gems/ruby-2.2.9@global/bin
=:~/.rvm/rubies/ruby-2.2.9/bin
X=:/opt/local/bin
X=:/opt/local/sbin
=:~/.nvm/versions/node/v8.11.3/bin
~:/usr/local/bin
~:/usr/bin
~:/bin
~:/usr/sbin
~:/sbin
>:/usr/local/share/dotnet
>:/opt/X11/bin
>:/Library/Frameworks/Mono.framework/Versions/Current/Commands
X-:~/.rvm/bin
X-:~/.local/bin
X-:/usr/local/Cellar/aria2/1.33.1/bin
X-:~/Documents/code/flutter/sdk/flutter/bin
X-:~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-:~/Documents/code/flutter/sdk/flutter/.pub-cache/bin
------ fish & echo $PATH
~/usr/local/bin
~/usr/bin
~/bin
~/usr/sbin
~/sbin
>/opt/X11/bin
>/usr/local/share/dotnet
>/Library/Frameworks/Mono.framework/Versions/Current/Commands
=~/.rvm/gems/ruby-2.2.9/bin
=~/.rvm/gems/ruby-2.2.9@global/bin
=~/.rvm/rubies/ruby-2.2.9/bin
X=/opt/local/bin
X=/opt/local/sbin
=~/.nvm/versions/node/v8.11.3/bin
X-~/.rvm/bin
X-~/.local/bin
X-/usr/local/Cellar/aria2/1.33.1/bin
X-~/Documents/code/flutter/sdk/flutter/bin
X-~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-~/Documents/code/flutter/sdk/flutter/.pub-cache/bin
这是来自 this PR、
的简单解决方法
# Download patched config
curl -O https://raw.githubusercontent.com/fish-shell/fish-shell/e18354bc6ef937e2e663fc098cc51a2546d4d2d0/share/config.fish
# Install config
mv config.fish /usr/local/share/fish/
为简单起见,下载并安装 fish-2.7.1.pkg 版本 Mac 上没有此错误。
根据代码提交,下一个版本fish-3.1.0
可能会修复这个错误。
这里是我如何解决它的(仅使用 fish 作为我的 zsh 之上的交互):
在.zshrc
中:
export ZSHPATH="$PATH"
fish
在.config/fish/config.fish
set PATH $ZSHPATH $PATH
fish --version
> fish, version 3.0.2
uname -a
> Darwin Jerrys-MacBook.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
echo $TERM
> xterm-256color
我在bash和fish
shell中比较了我的$PATH,rvm
的顺序改变了,这导致which pod
变得不同(i使用 rvm
来管理 ruby
)。
我怎样才能使它们的顺序相同?
顺便说一句,
- 我已将所有设置包含在
.bashrc
中,并通过source ~/.bashrc
在.bash_profile
中加载它,并在.prfile
中注明
- 我什么都没有
~/.config/fish/config.fish
x
、~
、=
、>
的开头字符我加了标记方便比较
----- echo $PATH
=:~/.rvm/gems/ruby-2.2.9/bin
=:~/.rvm/gems/ruby-2.2.9@global/bin
=:~/.rvm/rubies/ruby-2.2.9/bin
X=:/opt/local/bin
X=:/opt/local/sbin
=:~/.nvm/versions/node/v8.11.3/bin
~:/usr/local/bin
~:/usr/bin
~:/bin
~:/usr/sbin
~:/sbin
>:/usr/local/share/dotnet
>:/opt/X11/bin
>:/Library/Frameworks/Mono.framework/Versions/Current/Commands
X-:~/.rvm/bin
X-:~/.local/bin
X-:/usr/local/Cellar/aria2/1.33.1/bin
X-:~/Documents/code/flutter/sdk/flutter/bin
X-:~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-:~/Documents/code/flutter/sdk/flutter/.pub-cache/bin
------ fish & echo $PATH
~/usr/local/bin
~/usr/bin
~/bin
~/usr/sbin
~/sbin
>/opt/X11/bin
>/usr/local/share/dotnet
>/Library/Frameworks/Mono.framework/Versions/Current/Commands
=~/.rvm/gems/ruby-2.2.9/bin
=~/.rvm/gems/ruby-2.2.9@global/bin
=~/.rvm/rubies/ruby-2.2.9/bin
X=/opt/local/bin
X=/opt/local/sbin
=~/.nvm/versions/node/v8.11.3/bin
X-~/.rvm/bin
X-~/.local/bin
X-/usr/local/Cellar/aria2/1.33.1/bin
X-~/Documents/code/flutter/sdk/flutter/bin
X-~/Documents/code/flutter/sdk/flutter/bin/cache/dart-sdk/bin
X-~/Documents/code/flutter/sdk/flutter/.pub-cache/bin
这是来自 this PR、
的简单解决方法# Download patched config
curl -O https://raw.githubusercontent.com/fish-shell/fish-shell/e18354bc6ef937e2e663fc098cc51a2546d4d2d0/share/config.fish
# Install config
mv config.fish /usr/local/share/fish/
为简单起见,下载并安装 fish-2.7.1.pkg 版本 Mac 上没有此错误。
根据代码提交,下一个版本fish-3.1.0
可能会修复这个错误。
这里是我如何解决它的(仅使用 fish 作为我的 zsh 之上的交互):
在.zshrc
中:
export ZSHPATH="$PATH"
fish
在.config/fish/config.fish
set PATH $ZSHPATH $PATH