LINK="#3366FF" VLINK="#A000A0">



[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7 [ Index of Past Answers ]


(?) The Answer Gang (!)


By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!
Send questions (or interesting answers) to The Answer Gang for possible publication (but read the guidelines first)


(!) Adding seldom-used directories to your PATH

Answer (as originally posted on linux-list) by Ted Stern

This content is actually from several messages originally from linux-list, and I have moved around parts for readability. I hope you all don't mind. -- Heather
The question was how to add a path for occasionally-used scripts without having to modify the PATH variable directly. Matlab has a command 'addpath' that does this. He tried to do it with a shell script, but of course that didn't work because it executes in a subprocess, and subprocesses can't modify their parent's environment.
The more people banging on modules the better. I think it would be great if all package maintainers could set up a modulefile to go with their installations.
Here at Cray, we are in the midst of a giant package installation sequence. Given that there are dozens of open/free/GPL software packages around, and our techies like to use them on all the platforms they work on, it has been nightmarish trying to keep up with every single software distribution. So they set up something called "cfengine" (I think) and each package gets its own automatic modulefile. This makes it easy to get access to tools like LaTeX if you need them.
... later he adds ...
I found the name of the package we are using here to install 100's of ports for various platforms:
MPKG
http://staff.e.kth.se/mpkg
It is already integrated with Environment Modules!

Others have posted various ways to do this, but I'd like to point out that they are all re-inventing the wheel.
A method to modify environment variables cleanly was developed over 10 years ago. It is called Environment Modules. It compiles under Linux. It happens to be the method Cray has used for the last 7 years to modify paths for different versions of its compilers and libraries.
You can even get the latest version via anonymous CVS from sourceforge.
See http://modules.sourceforge.net for more details.
Here's an example of how it works.
In your startup file, (I use tcsh) you put a line like
	source /opt/Modules/default/init/tcsh
In a directory filled with "modulefiles", one modulefile named "myghost" might contain some commands like
	setenv        GS_LIB /local/path/to/my/ghostscript/lib
	prepend-path  PATH   /local/path/to/my/ghostscript/bin
	prepend-path  PATH   /local/path/to/my/ghostcript/man
To access your local ghostscript stuff, you could say
	module load myghost
and the environment variables are modified as you would expect them to be.
To remove all trace of your changes, you do
	module unload myghost
and all is as it was before.
The Environment Modules package has been banged on in a variety of production settings at SUN (where it was initially developed), SGI, IBM, HP, etc., so it is fairly robust.
There is also a mailing list (majordomo), with extremely low traffic, mostly just announcements:
	modules-interest@eng.auburn.edu
There are probably other packages to do the same things as Environment Modules, but I doubt that they have as much infiltration into the corporate infrastructure ;-) .
Good luck, Ted
gpg fingerprint = 6171 14B3 A323 965B 614D 056F B41C 03AE E404 986C

... Iron also asked Ted ...

(?) [Iron] How do you set your From: address on a per-list basis? Do you do something like "edit headers" in mutt and change it manually for each message? That would be tedious. Or do you have an automated way to do it?

(!) [Ted] Read the full header of an email message, and you will usually see an indication of what the MUA is.
I use Gnus, an extraordinarily powerful email package within Emacs. Of course, I also use the anon CVS version, so I sometimes have a few bugs to deal with ;-). But you can just use the version of Gnus that comes with Emacs if you like.
In my .gnus file, I have a setting as follows:
      (setq gnus-posting-styles
            '(
              ("^nnfolder.*:lists.gnus"
               (From "Ted Stern <stern+gnus@cray.com>"))
              ("^nnfolder.*:lists.fortran"
               (From "Ted Stern <stern+fortran@cray.com>"))
              ("^nnfolder.*:lists.linux"
               (From "Ted Stern <stern+linux@cray.com>"))
              ))
Gnus treats mail like news, so I read folders of mail as if they were groups. Within certain of my groups, the setting above adds the extra "From:" header.


This page edited and maintained by the Editors of Linux Gazette Copyright © 2002
Published in issue 78 of Linux Gazette May 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/


[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7 [ Index of Past Answers ]