[OS X TeX] X11

mark oilcan markoilcan at yahoo.com
Tue May 31 11:42:58 EDT 2005

--- GeGerbeniWierdaGeGerbeniWierdanrnalnlwrote:
> On May 27, 2005, at 23:22, Ettore AlAldrovandirote:
> > /etc/cscshscshrc> >
> > is read by non login shells.
> I cannot use these as they would be read every time and every
> susubshell
> call would add to the PATH once more.
> G

In practice this really isn't a problem. When the shell launches it
hashes the contents of the path, and, if a directory occurs multiple
times, the shell rereads and rehashes the contents. Yes, this can slow
down the time it takes to launch the shell, but that time will be
essentially imperceptible unless you add a *very* large directory to
the path many times over (by having a chain of subshells spawning
subshells, but then that's most likely to be a problem in and of
itself). Nevertheless, I agree that, from an aesthetic point of view,
adding a directory to the path repeatedly, is undesirable (though this
hasn't always stopped me). In that case, you can go through some minor
contortions and do what is done in fink and create an alias (or
function for [ba]sh) which only adds the directory to the path if it's
not there already. Here's how fink does it for csh: (mind possible
carriage returns added by email programs)

# Fink - a package manager that downloads source and installs it
# Copyright (c) 2001 Christoph Pfisterer
# Copyright (c) 2001-2004 The Fink Team
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
02111-1307, USA.

# define append_path and prepend_path to add directory paths, e.g.
# add to end of path
alias append_path 'if ( $\!:1 !~ \!:2\:* && $\!:1 !~ *\:\!:2\:* &&
$\!:1 !~ *\:\!:2 && $\!:1 !~ \!:2
 ) setenv \!:1 ${\!:1}\:\!:2'
# add to front of path
alias prepend_path 'if ( $\!:1 !~ \!:2\:* && $\!:1 !~ *\:\!:2\:* &&
$\!:1 !~ *\:\!:2 && $\!:1 !~ \!:
2 ) setenv \!:1 \!:2\:${\!:1}; if ( $\!:1 !~ \!:2\:* ) setenv \!:1
\!:2`echo \:${\!:1} | /usr/bin/sed -e s%^\!:2\:%% -e s%:\!:2\:%:%g -e

# setup fink related paths. we assume that the fink directories exists.
if ( $?PATH ) then
    prepend_path PATH /sw/bin:/sw/sbin
    setenv PATH /sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin

Yes, it's almost completely indecipherable (thanks csh!), but it should


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list