Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Source Link
JPB
  • 105
  • 2

Clarification on updating path in bashrc

I am following a tutorial on installing git on a shared host and need some clarification if possible.

I have access to the GCC

jpols@MrComputer ~
$ ssh nookdig1@***.***.**.*'gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'

and can edit the bashrc file:

jpols@MrComputer ~
$ vi .bashrc

However I dont really understand how to read if the path has been added correctly:

Update your $PATH None of this will work if you don’t update the $PATH environment variable. In most cases, this is set in .bashrc. Using .bashrc instead of .bash_profile updates $PATH for interactive and non-interactive sessions–which is necessary for remote Git commands. Edit .bashrc and add the following line:

export PATH=$HOME/bin:$PATH

I added the above to the file and saved but it goes on to say

Be sure ‘~/bin’ is at the beginning since $PATH is searched from left to right;

But ~/bin is different to the given path. Could someone please explain what this means?

After adding the Path as specified the output is:

jpols@MrComputer ~
$ source ~/.bashrc

jpols@MrComputer ~
$ echo $PATH
/home/jpols/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/nodejs:/cygdrive/c/Program Files/Git/cmd:GYP_MSVS_VERSION=2015:/cygdrive/c/WINDOWS/system32/config/systemprofile/.dnx/bin:/cygdrive/c/Program Files/Microsoft DNX/Dnvm:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/cygdrive/c/HashiCorp/Vagrant/bin:/cygdrive/c/MAMP/bin/php/php7.0.13:/cygdrive/c/ProgramData/ComposerSetup/bin:/cygdrive/c/Program Files (x86)/Yarn/bin:/cygdrive/c/Program Files/PuTTY:/cygdrive/c/Program Files (x86)/Brackets/command:/cygdrive/c/Program Files (x86)/Calibre2:/cygdrive/c/Ruby22-x64/bin:/cygdrive/c/Users/jpols/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/jpols/AppData/Roaming/npm:/cygdrive/c/Users/jpols/AppData/Roaming/Composer/vendor/bin:/cygdrive/c/Users/jpols/AppData/Local/Yarn/bin:/cygdrive/c/Program Files (x86)/Nmap

Just comparing the first part:

Tutorial: /home/joe/bin:/usr/local/bin:/bin:/usr/bin

Mine: /home/jpols/bin:/usr/local/bin:/usr/bin:/

They are different so before I go on I am hoping someone can explain what I am trying to achieve and how to do it correctly. Thanks.