$PATH question

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help

$PATH question

Postby EroSan on Sun Nov 23, 2008 4:28 pm

Hello. Im a newbie trying to learn the basics of bash... I am following this tutorial:
http://linuxcommand.org/learning_the_shell.php

Right now I am learning to make scripts, and I wanted to add a dir to $PATH to simplify testing the scripts I create to learn, but not just for the bash session... I want it to be permanent.

I googled for a solution, and it said to add it in .bash_profile which does not exist in Mint (I am guessing this is the same as ~/.profile). Anyway, the dir I want to add is called bin and its in my home, and in the .profile there were these lines already:

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


as far as I can tell that means that I shouldn't need to make any change... ~/bin should be added automatically to $PATH since the directory exists, right?

but its not! what am I doing wrong?
EroSan
Level 1
Level 1
 
Posts: 5
Joined: Fri Nov 21, 2008 10:09 pm

Linux Mint is funded by ads and donations.
 

Re: $PATH question

Postby Husse on Sun Nov 23, 2008 5:03 pm

I have not studied this in any detail, but notice that it says $HOME/bin not $HOME/your_user_name/bin
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19703
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: $PATH question

Postby EroSan on Sun Nov 23, 2008 5:22 pm

$HOME is equal to /home/erosan, at least bash seems to think so... cd $hOME/bin does takes me to the correct folder...

I usually dont stop trying, so after more research: I noticed that on .profile, it tries to see if there is a .bashrc file and load it. I have created the file .bashrc and added the directory to the path (PATH="$HOME/bin:$PATH"), thus solving my problem...

but why does that other part of the .profile does not work keeps puzzling me. I mean, I did not type that... its the way Felina RC1 comes by default. Maybe it is a bug?
EroSan
Level 1
Level 1
 
Posts: 5
Joined: Fri Nov 21, 2008 10:09 pm


Return to Newbie Questions

Who is online

Users browsing this forum: administrollaattori, Bing [Bot], Google [Bot], imanoob, JeremyB, norm.h and 38 guests