Modifying PATH with fish shell

后端 未结 5 804

I\'m currently playing around with the fish shell and I\'m having some trouble wrapping my head around how the PATH variable is set. For what it\'s worth, I\'m

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 13:35

    Like all shells, fish inherits its PATH from the environment it is started in. How this is set for login shells differs between operating systems - on Linux, for example, /etc/login.defs controls the initial PATH set for all login shells. I don't know how this is set on OS X.

    Next, like bash or csh, the initialisation files for the shell may alter the path. For fish on OS X, there is code in share/fish/config.fish to load paths from the standard OS X path configuration files /etc/paths and /etc/paths.d/*. There is alternative code to set a useful path on Solaris.

    There is also code to pick up paths from the universal variable $fish_user_paths, which is the right way to add something to your PATH and have it reflected across all shells.

提交回复
热议问题