![]() ![]() Simply prints or echoes what follows to stdout, which in the above instance is the terminal. To explain echo "export PATH=/usr/local/bin:$PATH" To fix it you want: echo "export PATH=/usr/local/bin:$PATH" > ~/.bash_profile & source ~/.bash_profile To your shell Path and PATH are very different things. The mistake in the line you've provided is that only the first letter of PATH is capitalised. ![]() bash_profile is a text file stored in your home directory that is sourced (read) every time bash (your shell) starts. ![]() What the command you have provided is trying to do is add a line to your. This means that any executables you install with brew will be used in preference to the system defaults. Adding /usr/local/bin to the beginning of PATH means that the shell will search there first and so if you have an executable foo in that folder it will be used in preference to any other foo executables you may have in the folders in your path. You can see what is in your PATH currently (as you can with all environment variables) by entering: echo $Īs I mentioned earlier, ordering is important. The PATH environment variable therefore saves you some extra typing. Thus fully the command is /bin/mv foo bar When you use a command that is not built into the shell you are using the shell will search through these directories in order and will execute the first matching executable it finds.įor example when you type: mv foo bar the shell is almost certainly actually using an executable located in the /bin directory. The PATH environment variable is a list of directories that the shell uses to search for executables. To answer your first question in order to run (execute) a program (executable) the shell must know exactly where it is in your filesystem in order to run it. TL DR echo "export PATH=/usr/local/bin:$PATH" > ~/.bash_profile & source ~/.bash_profile ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |