|
|
|
|
||||||
| linux.debian.user debian-user@lists.debian.org. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I want to add the dir ~/scripts to my path, what command do I use for that? M> echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/games But how do I add ~/scripts to that path? Thanks, Manon. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Manon Metten wrote:
> Hi, > > I want to add the dir ~/scripts to my path, what command do I use for that? > > M> echo $PATH > /usr/local/bin:/usr/bin:/bin:/usr/games > > But how do I add ~/scripts to that path? Do something like this $ export PATH=~/scripts:$PATH If you put it into the appropriate startup script it will get done every time. Mike -- p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){pri ntf(p,34,p,34);} Oppose globalization and One World Governments like the UN. This message made from 100% recycled bits. You have found the bank of Larn. I can explain it for you, but I can't understand it for you. I speak only for myself, and I am unanimous in that! -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hi Mike,
On 8/7/07, Mike McCarty <Mike.McCarty@sbcglobal.net> wrote: Do something like this > > $ export PATH=~/scripts:$PATH > > If you put it into the appropriate startup script it will get done > every time. I was looking for some kind of 'path' command but could not find anything alike. I didn't know of 'export'. I just found out that if I add my dir to /etc/profile it's available every time. Thanks, Manon. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Tue, Aug 07, 2007 at 06:24:08PM +0200, Manon Metten wrote:
> Hi Mike, > > On 8/7/07, Mike McCarty <Mike.McCarty@sbcglobal.net> wrote: > > Do something like this > > > > $ export PATH=~/scripts:$PATH > > > > If you put it into the appropriate startup script it will get done > > every time. > > > > I was looking for some kind of 'path' command but could not find anything > alike. I didn't know of 'export'. $PATH is an environment variable like any other and gets assigned a value in the same way as any other. export is used to make a variable available to other processes that come after the one spawned by the assignment process. Thus any process that is a child of the parent of the export statement gets access to that variable. so this is just three actions jammed together and its processed in a way better expressed like this: export ( assign the value of (concatenating ~/script: and ( the expanded value of PATH )) to PATH ) using standard mathematical parenthesis precedence. start with the inner parenthesis: expand the value of PATH, that is what PATH is current assigned. Next parenthesis, concatenate ~/script: and the previous result (the value of PATH). Next parenthesis, assign the previous result (concatenationg) to the variable PATH. Next parenthesis, export that value to the next level up in the hierarchy so that other processes can access it. This assignment will only exist in the shell in which it executed. When you exit that shell, it will disappear along with that shell. That's why you put somewhere where it will get started for every shell... A next comes lisp ![]() -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGuLAgaIeIEqwil4YRAprZAJ44yNqUayYcyYA0BPB7P0 kLOaUxEwCfW/sk GjNCAV2E5wBbPpfpzy+rYWM= =b7fn -----END PGP SIGNATURE----- |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Tue, Aug 07, 2007 at 06:24:08PM +0200, Manon Metten wrote:
> Hi Mike, > > On 8/7/07, Mike McCarty <Mike.McCarty@sbcglobal.net> wrote: > > Do something like this > > > > $ export PATH=~/scripts:$PATH > > > > If you put it into the appropriate startup script it will get done > > every time. > > > > I was looking for some kind of 'path' command but could not find anything > alike. I didn't know of 'export'. $PATH is an environment variable like any other and gets assigned a value in the same way as any other. export is used to make a variable available to other processes that come after the one spawned by the assignment process. Thus any process that is a child of the parent of the export statement gets access to that variable. so this is just three actions jammed together and its processed in a way better expressed like this: export ( assign the value of (concatenating ~/script: and ( the expanded value of PATH )) to PATH ) using standard mathematical parenthesis precedence. start with the inner parenthesis: expand the value of PATH, that is what PATH is current assigned. Next parenthesis, concatenate ~/script: and the previous result (the value of PATH). Next parenthesis, assign the previous result (concatenationg) to the variable PATH. Next parenthesis, export that value to the next level up in the hierarchy so that other processes can access it. This assignment will only exist in the shell in which it executed. When you exit that shell, it will disappear along with that shell. That's why you put somewhere where it will get started for every shell... A next comes lisp ![]() -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGuLAgaIeIEqwil4YRAprZAJ44yNqUayYcyYA0BPB7P0 kLOaUxEwCfW/sk GjNCAV2E5wBbPpfpzy+rYWM= =b7fn -----END PGP SIGNATURE----- |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Hi Nyizsnyik,
On 8/7/07, Nyizsnyik Ferenc <nyizsa@bluebottle.com> wrote: I would rather you checked your ~/.bash_profile file. > What's the reason I shouldn't touch /etc/profile but use ~/.bash_profile instead? Manon. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Tue, 7 Aug 2007, Manon Metten wrote: > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? A study of tutorial on Unix/Linux will take you a long way. HTH, -ishwar -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Tue, 7 Aug 2007, Manon Metten wrote: > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? A study of tutorial on Unix/Linux will take you a long way. HTH, -ishwar -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Hi Andrew,
On 8/7/07, Andrew Sackville-West <andrew@farwestbilliards.com> wrote: $PATH is an environment variable like any other and gets assigned a > value in the same way as any other. export is used to make a variable > available to other processes that come after the one spawned by the > assignment process. Thus any process that is a child of the parent of > the export statement gets access to that variable. > so this is just three actions jammed together and its processed in a way > better expressed like this: > > <SNIP> > > This assignment will only exist in the shell in which it > executed. When you exit that shell, it will disappear along with that > shell. That's why you put somewhere where it will get started for > every shell... Thanks for explaining. So I understand that export PATH=~/scripts:$PATH concatenates "~/scripts" and "$PATH" and sets the result to be the new $PATH. This is kinda like on my old Amiga where I have a 'path' command, but where I must use the ADD option, otherwise the path would be replaced (like using export PATH=~/scripts): path ~/scripts add == export PATH=~/scripts:$PATH If I want an environment variable available all the time, I should place it in either /etc/profile or ~/.bash_profile, right? Manon. |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote:
[..snip..] > If I want an environment variable available all the time, I should place it > in > either /etc/profile or ~/.bash_profile, right? Yes. Preferably ~/.bash_profile and export it. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote:
[..snip..] > If I want an environment variable available all the time, I should place it > in > either /etc/profile or ~/.bash_profile, right? Yes. Preferably ~/.bash_profile and export it. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote:
> > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? For the simple reason that you wouldn't want (or prefer) to mess with the system's defaults unless otherwise forced to. Moreover, think of a machine where you do not have root access, like one in your office or department or somewhere else. You can still add your local dirs to the PATH in ~/.bash_profile. For more on bash startup see /usr/share/doc/bash/examples/startup-files for examples. Take some time out and go thru man bash, it is a nice document. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote:
> > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? For the simple reason that you wouldn't want (or prefer) to mess with the system's defaults unless otherwise forced to. Moreover, think of a machine where you do not have root access, like one in your office or department or somewhere else. You can still add your local dirs to the PATH in ~/.bash_profile. For more on bash startup see /usr/share/doc/bash/examples/startup-files for examples. Take some time out and go thru man bash, it is a nice document. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
Hi PK,
On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: > What's the reason I shouldn't touch /etc/profile but use > > ~/.bash_profile instead? > > For the simple reason that you wouldn't want (or prefer) to mess with > the system's defaults unless otherwise forced to. Moreover, think of a > machine where you do not have root access, like one in your office or > department or somewhere else. You can still add your local dirs to the > PATH in ~/.bash_profile. > > For more on bash startup see > /usr/share/doc/bash/examples/startup-files for examples. I ain't got no /usr/share/doc/bash/examples dir. There's also no /usr/local/share/doc dir. Where do I get these examples? Take some time out and go thru man bash, it is a nice document. Well, actually I'm considering to work my way through the Advanced Bash Scripting Guide. So I'll be back in a couple of months :-) Thanks & greetings, Manon. |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
Hi PK,
On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: > What's the reason I shouldn't touch /etc/profile but use > > ~/.bash_profile instead? > > For the simple reason that you wouldn't want (or prefer) to mess with > the system's defaults unless otherwise forced to. Moreover, think of a > machine where you do not have root access, like one in your office or > department or somewhere else. You can still add your local dirs to the > PATH in ~/.bash_profile. > > For more on bash startup see > /usr/share/doc/bash/examples/startup-files for examples. I ain't got no /usr/share/doc/bash/examples dir. There's also no /usr/local/share/doc dir. Where do I get these examples? Take some time out and go thru man bash, it is a nice document. Well, actually I'm considering to work my way through the Advanced Bash Scripting Guide. So I'll be back in a couple of months :-) Thanks & greetings, Manon. |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
On Aug 7, 2007, at 11:02 AM, Manon Metten wrote: > Hi Nyizsnyik, > > On 8/7/07, Nyizsnyik Ferenc <nyizsa@bluebottle.com> wrote: > > I would rather you checked your ~/.bash_profile file. > > > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? They do the same thing, but for different scopes. /etc/profile affects every account on the system. ~/.bash_profile only affects your own. On a single-user machine the distinction is meaningless, but on a multi-user system it's important. Software installed publicly for everyone goes in the PATH set in /etc/profile, software installed in an individual person's home directory goes in the PATH set in ~/.bash_profile. It's good to get in the habit of thinking about these distinctions, because some day you might be administering a machine that's used by other people. Generally unless you have a specific reason to put something there, you want to leave /etc/profile alone. |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
On Aug 7, 2007, at 11:02 AM, Manon Metten wrote: > Hi Nyizsnyik, > > On 8/7/07, Nyizsnyik Ferenc <nyizsa@bluebottle.com> wrote: > > I would rather you checked your ~/.bash_profile file. > > > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? They do the same thing, but for different scopes. /etc/profile affects every account on the system. ~/.bash_profile only affects your own. On a single-user machine the distinction is meaningless, but on a multi-user system it's important. Software installed publicly for everyone goes in the PATH set in /etc/profile, software installed in an individual person's home directory goes in the PATH set in ~/.bash_profile. It's good to get in the habit of thinking about these distinctions, because some day you might be administering a machine that's used by other people. Generally unless you have a specific reason to put something there, you want to leave /etc/profile alone. |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
Hello Mannon,
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote: > Hi PK, > > On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: [...snip...] > > For more on bash startup see > > /usr/share/doc/bash/examples/startup-files for examples. > > > I ain't got no /usr/share/doc/bash/examples dir. > There's also no /usr/local/share/doc dir. > Where do I get these examples? apt-get install bash-doc In general, for any package, pkg, pkg-doc is a good source of and examples. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
Hello Mannon,
On 8/7/07, Manon Metten <manon.metten@gmail.com> wrote: > Hi PK, > > On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: [...snip...] > > For more on bash startup see > > /usr/share/doc/bash/examples/startup-files for examples. > > > I ain't got no /usr/share/doc/bash/examples dir. > There's also no /usr/local/share/doc dir. > Where do I get these examples? apt-get install bash-doc In general, for any package, pkg, pkg-doc is a good source of and examples. -- Regards PK -------------------------------------- http://counter.li.org #402424 -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
Hi David,
On 8/7/07, David Brodbeck <brodbd@u.washington.edu> wrote: > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? > > They do the same thing, but for different scopes. /etc/profile affects > every account on the system. ~/.bash_profile only affects your own. > > On a single-user machine the distinction is meaningless, but on a > multi-user system it's important. Software installed publicly for everyone > goes in the PATH set in /etc/profile, software installed in an individual > person's home directory goes in the PATH set in ~/.bash_profile. It's good > to get in the habit of thinking about these distinctions, because some day > you might be administering a machine that's used by other people. > > Generally unless you have a specific reason to put something there, you > want to leave /etc/profile alone. > Thanks for this clear explanation. I'll follow your advice. Manon. |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
Hi David,
On 8/7/07, David Brodbeck <brodbd@u.washington.edu> wrote: > What's the reason I shouldn't touch /etc/profile but use > ~/.bash_profile instead? > > They do the same thing, but for different scopes. /etc/profile affects > every account on the system. ~/.bash_profile only affects your own. > > On a single-user machine the distinction is meaningless, but on a > multi-user system it's important. Software installed publicly for everyone > goes in the PATH set in /etc/profile, software installed in an individual > person's home directory goes in the PATH set in ~/.bash_profile. It's good > to get in the habit of thinking about these distinctions, because some day > you might be administering a machine that's used by other people. > > Generally unless you have a specific reason to put something there, you > want to leave /etc/profile alone. > Thanks for this clear explanation. I'll follow your advice. Manon. |
|
|
|
#22 |
|
Messages: n/a
Hébergeur: |
Manon Metten wrote:
> Hi Mike, > > On 8/7/07, Mike McCarty <Mike.McCarty@sbcglobal.net> wrote: > > Do something like this > >>$ export PATH=~/scripts:$PATH >> >>If you put it into the appropriate startup script it will get done >>every time. > > I was looking for some kind of 'path' command but could not find anything > alike. I didn't know of 'export'. Well, I combined two commands into one. $ x=y sets an environment variable x to value y. $ export x makes x available to all subprocesses in the tree which get created after the export. $ export x=y does both at the same time. PATH is an environment variable like any other in this regard. I don't believe that ksh can do this, for example. I probably shouldn't have done that. > I just found out that if I add my dir to /etc/profile it's available every > time. Umm, not where I would have put it. That affects every user. I'd put it into ~/.bash_profile because I use bash. That way it would affect only me. If another user doesn't use bash as his shell, then he'll break. Mike -- p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){pri ntf(p,34,p,34);} Oppose globalization and One World Governments like the UN. This message made from 100% recycled bits. You have found the bank of Larn. I can explain it for you, but I can't understand it for you. I speak only for myself, and I am unanimous in that! -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#23 |
|
Messages: n/a
Hébergeur: |
Manon Metten wrote:
> Hi Mike, > > On 8/7/07, Mike McCarty <Mike.McCarty@sbcglobal.net> wrote: > > Do something like this > >>$ export PATH=~/scripts:$PATH >> >>If you put it into the appropriate startup script it will get done >>every time. > > I was looking for some kind of 'path' command but could not find anything > alike. I didn't know of 'export'. Well, I combined two commands into one. $ x=y sets an environment variable x to value y. $ export x makes x available to all subprocesses in the tree which get created after the export. $ export x=y does both at the same time. PATH is an environment variable like any other in this regard. I don't believe that ksh can do this, for example. I probably shouldn't have done that. > I just found out that if I add my dir to /etc/profile it's available every > time. Umm, not where I would have put it. That affects every user. I'd put it into ~/.bash_profile because I use bash. That way it would affect only me. If another user doesn't use bash as his shell, then he'll break. Mike -- p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){pri ntf(p,34,p,34);} Oppose globalization and One World Governments like the UN. This message made from 100% recycled bits. You have found the bank of Larn. I can explain it for you, but I can't understand it for you. I speak only for myself, and I am unanimous in that! -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
|
|
#24 |
|
Messages: n/a
Hébergeur: |
Hi PK,
On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: > I ain't got no /usr/share/doc/bash/examples dir. > > There's also no /usr/local/share/doc dir. > > Where do I get these examples? > > apt-get install bash-doc > > In general, for any package, pkg, pkg-doc is a good source of and > examples. Waw, thanks again! This is very useful stuff. Greetings, Manon. |
|
|
|
#25 |
|
Messages: n/a
Hébergeur: |
Hi PK,
On 8/7/07, P Kapat <kap4lin@gmail.com> wrote: > I ain't got no /usr/share/doc/bash/examples dir. > > There's also no /usr/local/share/doc dir. > > Where do I get these examples? > > apt-get install bash-doc > > In general, for any package, pkg, pkg-doc is a good source of and > examples. Waw, thanks again! This is very useful stuff. Greetings, Manon. |
|
![]() |
| Outils de la discussion | |
|
|