Results 1 to 10 of 16
Thread: changing PATH variable
|
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
03-24-2006 #1Just Joined!
- Join Date
- Dec 2005
- Posts
- 30
changing PATH variable
Hi there,
I just migrated from Fedora to Debian. In Fedora i could change the PATH env variable by editing the .bash_profile file. How do you do the same thing in Debian.
Thanks in advance.
-
03-24-2006 #2
There might be a better way of doing this, but this is how I do it.
Edit /etc/profile, and add these lines at the bottom - obviously change the variable names and the paths to suit your machine.
Then logout and log back in.Code:BENS_HOME=/home/ben QMAIL_STUFF=/var/qmail/scripts PATH=$PATH:$BENS_HOME:$QMAIL_STUFF EXPORT PATH BENS_HOME QMAIL_STUFF
Registered Linux user #389109
My Semi-Linux Blog
-
03-24-2006 #3
In Debian, the equivalent of .bash_profile is .bashrc, so you should be able to edit that file the way you're used to.
Stand up and be counted as a Linux user!
-
03-25-2006 #4Just Joined!
- Join Date
- Dec 2005
- Posts
- 30
I just want to include the current directory in the list of directories specified by PATH variable. So i added the following line in .bashrc file
PATH=$PATH:.
but it doesnt work. I mean if i execute any program in the current directory, and the current directory is not in the PATH variable. I get a command not found message.
-
03-25-2006 #5
According to my copy of debian bible.for adding the paths /usr/local/sbin,/usr/sbin/,/sbin to env.
open up your ~/.bashrc in your favourite editor,and near the top of the file(Just after the first block of comments),add the following line:
save the file and then log out and log back in.runCode:PATH="/usr/local/sbin: /sbin: /usr/sbin: $PATH
to verify.Code:echo "$PATH"
-
03-25-2006 #6May I ask why not just prepend the command or executable with a ./ or sh?
Originally Posted by tnlg102
Stand up and be counted as a Linux user!
-
03-26-2006 #7Just Joined!
- Join Date
- Feb 2006
- Posts
- 15
I agree with Zelmo. Also, it is recommended that the working directory should never be put first in your PATH. One could accidentally execute a command in the working directory that masks an common command. For example, if an executable named ls exists in the working directory then it would be executed instead of the ls command in the /bin directory. This could have disasterous effects, especially if you are superuser and the ls command was placed there malicously.
-
03-26-2006 #8Just Joined!
- Join Date
- Dec 2005
- Posts
- 30
I run linux on my home pc, so security is not a big consideration. I think that it is a pain to prepend the name of the executable with ./ everytime i want to execute it.
Originally Posted by CanyonMan
-
03-26-2006 #9Just Joined!
- Join Date
- Dec 2005
- Posts
- 30
I finally got to include the current directory in the PATH variable. I just added the following line to the .bashrc file
PATH = ".":$PATH
thank you guys for your replies.
-
08-27-2006 #10Just Joined!
- Join Date
- Aug 2006
- Posts
- 9
bump for similar question
New to Debian, and Linux in general...
Editing ~/.bashrc certainly does the trick for $PATH in the shell. Unfortunately this doesn't do what I thought it did, which would be to change the search path in general; e.g., I write a shell script to java -jar foo.jar but the script won't work when clicked from e.g. the file manager or the desktop, even if I choose "Run in Terminal." (Surely, I thought, the latter would work.)
From my initial research I thought editing /etc/profile would work but none of my changes show up in $PATH after logout. I've tried editing the line where PATH is defined and I've tried stokes's method. For the meantime I've just put a new PATH=$PATH:/<javapath> statement in the shell; it works, but it seems wrong to me.
Thanks for any help.


Reply With Quote