[SOLVED] edit to .bashrc makes other directories executable, not just ~/bin
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.
edit to .bashrc makes other directories executable, not just ~/bin
I added this to my .bashrc
Code:
. /etc/profile
PATH=$PATH:~/bin
expecting it would just cause ~/bin to allow files to be executed. However, it has allowed me to execute files in other directories located in the home directory.
I also tried adding this to .bashrc (not at the same time):
Code:
export PATH=~/bin:"$PATH"
with the same result.
I just want ~/bin to be able to allow files to be executed
Alien Bob, you are correct, there is a copy of hello_world in ~/bin.
I have deleted it. But then when I cd to ~/test this is what happens:
Code:
mik@linuxbox:~/test$ ls
c-scripts/ hello_world* hello_world~*
mik@linuxbox:~/test$ hello_world
bash: /home/mik/bin/hello_world: No such file or directory
Alien Bob, you are correct, there is a copy of hello_world in ~/bin.
I have deleted it. But then when I cd to ~/test this is what happens:
Code:
mik@linuxbox:~/test$ ls
c-scripts/ hello_world* hello_world~*
mik@linuxbox:~/test$ hello_world
bash: /home/mik/bin/hello_world: No such file or directory
This is a Bash behavior, it remembers (or 'hashes) the path from where it started your programs.
Try
Code:
$ type hello_world
You should get something like:
Code:
hello_world is hashed (/home/mik/bin/hello_world)
To remove this hash so that Bash no longer remembers the path where it found the program:
Code:
$ hash -d hello_world
$ hello_world
bash: /home/mik/bin/hello_world: No such file or directory
This is a Bash behavior, it remembers (or 'hashes) the path from where it started your programs.
Try
Code:
$ type hello_world
You should get something like:
Code:
hello_world is hashed (/home/mik/bin/hello_world)
To remove this hash so that Bash no longer remembers the path where it found the program:
Code:
$ hash -d hello_world
$ hello_world
bash: /home/mik/bin/hello_world: No such file or directory
I've been using Linux for close to 20 years and I never knew about this! Thanks for teaching me something new! For those interested in learning more, see this StackExchange answer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.