|
#1
| ||||
| ||||
| [HOW TO] Preserve a custom shell $PATH after logout.
I was struggling for some time to come up with an efficient way to add custom folders to the shell $PATH that would be retained after logout. This is the protocol I came up with. 1. With your favourite editor, create a file called ~/.path 2. In it, add lines of the format: set path = ( $path /Path_you_wish_to_add ) You can either continue to add lines like this, or better, you can add to that single line every time you have a folder you want to add, separated by a space, with a space after ( and before ). 3. Add the following line to your ~/.tcshrc file (if you don't have one, create it): source .path Now, every time you log in, your custom path will be appended to your existing path. You can change the search order by putting your own folders before or after the $path variable, but unless you have a good reason, don't. NOTE: You should always add folders to your $PATH using the full path from root. So if you want to add ~/bin add it as /Users/username/bin I feel this is the more elegant solution, especially if you have multiple-user system, than adding a 'set path = ( $path /custom_path )' in your '~/.login' file, but I suppose you can do that too.
__________________ michaelsanford.com • Identi.ca • iMac Aluminum 24" | MacOS X 10.5 (current) | 3.06 GHz Intel Core Duo | 4 GB RAM, 1 TB HDD • Acer AspireOne 1.60 GHz | Windows XP Home | 1 GB RAM, 100 GB HDD • AMD Athlon64 3500+ | Ubuntu-server x86_64 | 1240 GB RAID Last edited by michaelsanford; February 20th, 2003 at 10:28 PM. |
|
#2
| |||
| |||
|
Here is a standard way of adding to your PATH: echo 'setenv PATH "${PATH}:/usr/local/bin:/Developer/Tools:/some/other/path"' >> ~/.tcshrc source ~/.tcshrc to have it effective immediately. You can add it manually with a text editor if you like. As an alternative, you could choose to add it to ~/Library/init/tcsh/path.mine instead of your .*cshrc file, but I prefer to have everything in one compact file for easy backup, portability, and migration from one system to another. |
|
#3
| ||||
| ||||
|
I thought the path file was the only one that didn't take a .mine (so ~/Library/init/tcsh/path )? I tried that first, and I get errors every time I logged in, so I had to do this instead... I certainly see how you can prefer to have everything in one file; I prefer multiple files myself but that's just me
__________________ michaelsanford.com • Identi.ca • iMac Aluminum 24" | MacOS X 10.5 (current) | 3.06 GHz Intel Core Duo | 4 GB RAM, 1 TB HDD • Acer AspireOne 1.60 GHz | Windows XP Home | 1 GB RAM, 100 GB HDD • AMD Athlon64 3500+ | Ubuntu-server x86_64 | 1240 GB RAID |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [HOW TO] Terminal | berniech | Unix & X11 | 8 | February 24th, 2003 03:26 PM |