View Full Version : [SOLVED] PATH enviroment
71GA
January 1st, 2011, 04:02 PM
Hello!
I have been playing with enviroment variables and have messed up with PATH variable. I think it had 3 paths included and i have to add them back. Can anyone tell me how can i add more paths under enviroment variable PATH?
Ty
nebileix
January 1st, 2011, 04:21 PM
PATH=<Path u wanna add>:"${PATH}"
Example: PATH=~/bin:"${PATH}"
71GA
January 1st, 2011, 05:45 PM
PATH=<Path u wanna add>:"${PATH}"Example: PATH=~/bin:"${PATH}"
Sooo :"${PATH}" at the end only says that it should add a path not to rewrite it.
If i would use a command: "PATH=/home/.../bin" this would totaly rewrite my PATH enviroment variable and i would loose all paths included in there right?
I think i understand now :)
TY
AlphaLexman
January 1st, 2011, 06:56 PM
Sooo :"${PATH}" at the end only says that it should add a path not to rewrite it.
If i would use a command: "PATH=/home/.../bin" this would totaly rewrite my PATH enviroment variable and i would loose all paths included in there right?
Yes, think of it like this:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
Each directory is separated by the : delimiter.
To add a directory to the variable $PATH, you must include the original value of the or you will lose it.
NOTE: placement of the additional directory can slow down your machine!
PATH=~/bin:"${PATH}"
will look in the user's ~/bin directory before looking for programs (such as 'ls') in /bin or /usr/bin where they most likely exist.
Whereas,
PATH="${PATH}":~/bin
will look in the user's ~/bin directory last.
71GA
January 4th, 2011, 12:51 PM
Wonderfull :)
Just one more thing about part of the command:
"${PART}"
Why is PART in a curly brackets?
What does a $ mean?
Why do we use "" ???
More i know more i ask i am sorry hehe :)
:KS
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.