Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Notes about $PATH
- You are probably used to lines like these in your shell config:
- ```sh
- export PATH="/usr/local/opt/gettext/bin:$PATH"
- ```
- Now, `$PATH` can also be modified like this in fish. However, it would not be very idiomatic.
- ## Adding to $PATHβthe fish way
- Fish has three excellent ideas:
- - "Lists" are a thing. No more `foo:bar:baz`.
- - Why not simply allow users to prepend to another variable instead of modifying the global $PATH.
- - Changing variables shouldn't be in your config. Persistency is done automatically.
- So. Instead of doing the `export` thing. Simply execute this in your terminal. I'm using `gettext` on MacOS as an example:
- ```fish
- ## Prepend a new bin folder.
- # * Separated by spaces as fish_user_paths is a list/array and fish can handle that
- # * -U (from `man set`): -U or --universal causes the specified shell variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current user's fish instances on the current computer, and will be preserved across restarts of the shell.
- set -U fish_user_paths /usr/local/opt/gettext/bin $fish_user_paths
- ```
- If you are curious, you can verify that this has indeed been written to `~/.config/fish/fish_variables`
Add Comment
Please, Sign In to add comment