Peter,
On Fri, 6 Jun 2003, Peter W. Draper wrote:
> > We (Glasgow) have a system like this for managing paths and stuff, so
> > you can type `use idl55', and your PATH, MANPATH and LD_LIBRARY_PATH,
> [...]
> That sounds potentially useful, if we decide to make the break, but just
> for interest sake how is the "use" command defined for each shell. For
> C-shell I'd guess this was an alias to a "source" command, but I've always
> been stuck for how this might be done so it looks easy using "sh".
The actual script has all the logic in Perl (though I have an alternative
better version in scheme-shell). It takes a sh/csh argument, and the
only shell-specific part is how to set and unset an environment variable
(setenv x y or export x=y) and how to source an external script for the
few cases where that's necessary -- fewer cases with the latter version.
When the script runs it generates a string `setenv X Y;echo "using
blah";/bin/true;', and that's eval'd using a shell-specific alias. So it's
somewhat hackish, but the hackery is reasonably modularised.
Norman
--
---------------------------------------------------------------------------
Norman Gray http://www.astro.gla.ac.uk/users/norman/
Physics and Astronomy, University of Glasgow, UK [log in to unmask]
|