0

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.

1 Answer 1

0

The '~' character is used to indicate the current user's home directory on UNIX systems. Because the username on your computer is different from the one on the machine used in the tutorial you referred to, different directory paths have been appended to the PATH variable. By using '~' one does not have to manually enter one's username for referring to the user home directory, which allowed the creator of the tutorial to create code which makes the PATH variable look into both of your home directories, even though both of your systems have different paths to your home directories. (e.g. /home/joe/bin and /home/jpols/bin are different directories, but ~/bin can be used to refer to both, as the '~' will be expanded to the correct path by the system)

2
  • You probably should not have / in your path: that's the root directory and there is no executable file in the root directory (usually).
    – NickD
    Commented Jul 12, 2017 at 4:13
  • Sorry if your referring to the last / that just abbrieviated from home/jpols/bin:/usr/local/bin:/usr/bin:/cygdrive/c/...... What I meant was how my path is local bin usr bin but the example is local bin bin usr bin. Is it ok if this is different? I am right that the : signifies the end of a path?
    – JPB
    Commented Jul 12, 2017 at 5:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .