There is a line in ~/.profile
which is
PATH="$HOME/bin:$HOME/.local/bin:$PATH"i
I'm not sure about the last i
.
- Should I remove it??
- Isn't it a syntax error??
There is a line in ~/.profile
which is
PATH="$HOME/bin:$HOME/.local/bin:$PATH"i
I'm not sure about the last i
.
No, it's not a syntax error; it's just a letter which is appended after the expansion of
$PATH
, because the shell removes quotes...So, as well as prepending local directories, it has effectively removed the existing
/snap/bin
from my PATH, and added the non-existent/snap/bini
.You can remove the
i
to repair your PATH.To see the change, you will need to log out and back in or run
source ~/.profile
in any shell you are using (or launch the shell withbash -l
), because.profile
is read by login shells only.If you did not make this change to your
.profile
yourself, you may want to restore the default file by runningThis renames the old
.profile
.profile.old
(you could also delete the file if you wanted to) and replaces it with the default version for your system from/etc/skel
.Yes it is a syntax error, the actual
.profile
should look like this unless you changed things around (this is the 17.10 version, see notes below it):This might look different in older versions of Ubuntu where the check if the users
bin
directory is present was not included into the.profile
. Eaisiest way to check how it should look like is taking a look at/etc/skel/.profile
.So to add as you asked in your comment simply place this at the end of your profile file:
If you ever mess up your profile completely, there is a copy where you can get a new one from in
/etc/skel/
.I think here is unclear what the following expression means:
The first part
PATH=
means we assign a new value to the (environment) variable$PATH
.The second part is the new value of that variable. In the current case the variable
$HOME
will be expanded with its current value and to that value will be appended the string/bin:
. The same goes for the next part of the string$HOME/.local/bin:
. Finally the current (previous) value of the$PATH
variable will be expanded and appended. The colon:
plays a role of delimiter in thePATH
expression.The goal is ultimately to write:
PATH=<some additional paths>+<the the current value of $PATH>
. We put these additional paths in front of the string, because we want the shell to search for executables first in these locations and only then system wide.The character
i
is unnecessary. It will be appended to the new value of$PATH
and will make a mess, as @Zanna explains in her answer.