![]() '20200418-vscode', I just use date to make the priority unique) Then store the path you want to add to PATH in it. The following steps show you how to modify system-wise PATH:Ĭreate a file with the naming convention: priority-appname(e.g. The following shows you how to modify user-wise PATH:Ĭreate/edit ~/.zprofile and add the following content: # append to PATH The file /etc/zprofile uses /usr/libexec/path_helper to set the default PATH and we don't have the source code of it. Note that PATH is already an environment variable, so exporting it again serves no purpose. Doing it in your $ZDOTDIR/.zshenv file would be unnecessary as that file is sourced by any type of zsh invocation (and should therefore be kept really short, if it's needed at all I just set ZDOTDIR=$HOME/.zsh in there, for example). You may want to do this in your $ZDOTDIR/.zprofile file, which is sourced automatically by any zsh login shell. The PATH variable's value will be updated accordingly. To append a couple of paths: path=( $path /new/path1 /new/path2 ) To prepend a couple of paths: path=( /new/path1 /new/path2 $path ) The variables will then stay unique by virtue of this command. You may make the PATH variable, and the associated path array, unique first, by using typeset -U -g PATH path You may easily add new paths to the PATH at either end or beginning, and zsh also has a convenient way of removing duplicates. As you said in your own self-answer, you don't need to know where the PATH variable is originally populated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |