.profile issue

Forum rules
Before you post please read how to get help
Post Reply
hacktorious
Level 1
Level 1
Posts: 1
Joined: Tue Aug 20, 2019 8:40 pm

.profile issue

Post by hacktorious » Tue Aug 20, 2019 8:55 pm

I was installing pipenv which requires pip3 and ran across the following issue as a result it broke pipenv and pip3.

$HOME should be ${HOME} in the PATH

Replacing this seemed to fix all my errors. Is this a bug?


Found This:

Code: Select all

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi
Should Be:

Code: Select all

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="${HOME}/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="${HOME}/.local/bin:$PATH"
fi

rene
Level 11
Level 11
Posts: 3603
Joined: Sun Mar 27, 2016 6:58 pm

Re: .profile issue

Post by rene » Wed Aug 21, 2019 6:07 am

hacktorious wrote:
Tue Aug 20, 2019 8:55 pm
Is this a bug?
Not a Debian/Ubuntu/Mint bug certainly. Shell variables cannot have a "/" in their name which is here to say that $HOME/bin and ${HOME}/bin are guaranteed to expand to one and the same when expanded by anything that would normally parse ~/.profile. Frankly I have trouble trying to imagine what could be the issue unless you use some weird shell or alike...

gm10
Level 18
Level 18
Posts: 8690
Joined: Thu Jun 21, 2018 5:11 pm

Re: .profile issue

Post by gm10 » Wed Aug 21, 2019 6:25 am

hacktorious wrote:
Tue Aug 20, 2019 8:55 pm
Replacing this seemed to fix all my errors.
Yes, but it only seemed to. As rene explained, both statements are equivalent. What confused you is that both statements check whether the private path exists, and in your case the one you needed did not yet exist when you logged in, so it did not become part of your $PATH variable. The next time you logged in again, however, it was now included in your PATH. No modification to ~/.profile necessary.
Tune up your LM 19.x: ppa:gm10/linuxmint-tools

Post Reply

Return to “Scripts & Bash”