SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Apart from the line the others have mentioned, you need to move the 'source $HOME/.bash_profile' line to after the end of the if statement (after the 'fi' line)
Otherwise it gets skipped if the ~/.local/bin directory exists.
At first I also believed that it was necessary to change the single quotes to double quotes but then I hesitated since the source command should act in the same right way.
Last edited by blancamolinos; 03-03-2021 at 08:17 PM.
Apart from the line the others have mentioned, you need to move the 'source $HOME/.bash_profile' line to after the end of the if statement (after the 'fi' line)
Otherwise it gets skipped if the ~/.local/bin directory exists.
Maybe I am wrong but my understanding was, when $HOME/local/bin exist, then the PATH to $HOME/.local/bin exist as well.
tests if the $LPATH directory doesn't exist. If it succeeds (i.e. the directory doesn't exist) then it runs all the following commands until the
Code:
fi
line.
Assuming you do indeed have a directory $HOME/.local/bin then this test will fail and the following commands (including the "source ..." command) won't run.
If you move the "source ..." line after the "fi" line it won't be dependant on the test and will run every time the script runs.
@pan64 - well, yes, that would be a clean way to do it :-) But the OP had a specific question about why the "source ..." line wasn't running.
tests if the $LPATH directory doesn't exist. If it succeeds (i.e. the directory doesn't exist) then it runs all the following commands until the
Code:
fi
line.
Assuming you do indeed have a directory $HOME/.local/bin then this test will fail and the following commands (including the "source ..." command) won't run.
If you move the "source ..." line after the "fi" line it won't be dependant on the test and will run every time the script runs.
@pan64 - well, yes, that would be a clean way to do it :-) But the OP had a specific question about why the "source ..." line wasn't running.
that if construct is just wrong. It did not check if the entry (LPATH) was already added to .bash_profile, and also "sometimes" it won't be sourced. Not to speak about other problems (see shellcheck for example, or error handling)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.