Mercurial > index.cgi > dotfiles
changeset 4:6ffd3fb73f7f
s/\~\//\$HOME\//g - There's possibly a nicer way to make sure tilde expansion
is done in the right places, but this works just as well and doesn't require
extra thinking when I'm half asleep :P
Added (^|:) to start, and ($|:) to end of all tests to make sure we're
matching a full path.
Also test for (and append if not there) a ':' at the end of $MANPATH;
otherwise Linux systems tend to forget how to search system paths.
author | huston@80426f53-59d1-405d-934b-f07cd76f4a1a |
---|---|
date | Sat, 11 Apr 2009 06:54:02 +0000 |
parents | 072b183989e0 |
children | 3d0de329a850 |
files | .bashrc |
diffstat | 1 files changed, 28 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/.bashrc Sat Apr 11 05:58:03 2009 +0000 +++ b/.bashrc Sat Apr 11 06:54:02 2009 +0000 @@ -1,7 +1,7 @@ # .bashrc # This file is sourced for shells which are interactive but not a # login shell; however, since it is also sourced within -# ~/.bash_profile, the end result is that this file is sourced for all +# $HOME/.bash_profile, the end result is that this file is sourced for all # shells. @@ -29,59 +29,64 @@ # they're not they should probably go near the front of the pack. for P in /sbin /usr/sbin /usr/local/bin /usr/local/sbin \ /opt/local/bin /opt/local/sbin ; do - [[ "$PATH" =~ $P ]] || \ + [[ "$PATH" =~ "(^|:)$P($|:)" ]] || \ export PATH=${P}${PATH:+:$PATH} done for M in /usr/local/share/man /usr/local/man /opt/local/share/man ; do - [[ "$MANPATH" =~ $M ]] || \ + [[ "$MANPATH" =~ "(^|:)$M($|:)" ]] || \ export MANPATH=${M}${MANPATH:+:$MANPATH} done # Local Perl install -if [ -d ~/perl ]; then - [[ "$PERL5LIB" =~ ~/perl ]] || \ - export PERL5LIB=~/perl${PERL5LIB:+:$PERL5LIB} +if [ -d $HOME/perl ]; then + [[ "$PERL5LIB" =~ "(^|:)$HOME/perl($|:)" ]] || \ + export PERL5LIB=$HOME/perl${PERL5LIB:+:$PERL5LIB} - if [ -d ~/perl/share/man ]; then - [[ "$MANPATH" =~ ~/perl/share/man ]] || \ - export MANPATH=~/perl/share/man:${MANPATH:+$MANPATH} + if [ -d $HOME/perl/share/man ]; then + [[ "$MANPATH" =~ "(^|:)$HOME/perl/share/man($|:)" ]] || \ + export MANPATH=$HOME/perl/share/man:${MANPATH:+$MANPATH} fi - if [ -d ~/perl/bin ]; then - [[ "$PATH" =~ ~/perl/bin ]] || \ - export PATH=~/perl/bin${PATH:+:$PATH} + if [ -d $HOME/perl/bin ]; then + [[ "$PATH" =~ "(^|:)$HOME/perl/bin($|:)" ]] || \ + export PATH=$HOME/perl/bin${PATH:+:$PATH} fi fi -# Local install paths - install things to ~/Installs directories, and +# Local install paths - install things to $HOME/Installs directories, and # they will automatically get the proper paths added. Most things # that use autoconf will do this with -# './configure --prefix=~/Installs' -for D in ~/Installs/* ; do +# './configure --prefix=$HOME/Installs' +for D in $HOME/Installs/* ; do if [ -d $D/bin ]; then - [[ "$PATH" =~ "$D/bin" ]] || \ + [[ "$PATH" =~ "(^|:)$D/bin($|:)" ]] || \ export PATH=$D/bin${PATH:+:$PATH} fi if [ -d $D/share/man ]; then - [[ "$MANPATH" =~ "$D/share/man" ]] || \ + [[ "$MANPATH" =~ "(^|:)$D/share/man($|:)" ]] || \ export MANPATH=$D/share/man:${MANPATH:+$MANPATH} fi if [ -d $D/man ]; then - [[ "$MANPATH" =~ "$D/man" ]] || \ + [[ "$MANPATH" =~ "(^|:)$D/man($|:)" ]] || \ export MANPATH=$D/man:${MANPATH:+$MANPATH} fi if [ -d $D/lib ]; then - [[ "$LD_LIBRARY_PATH" =~ "$D/lib" ]] || \ + [[ "$LD_LIBRARY_PATH" =~ "(^|:)$D/lib($|:)" ]] || \ export LD_LIBRARY_PATH=$D/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} fi done -# Now make sure ~/bin is top of the list -if [ -d ~/bin ]; then - [[ "$PATH" =~ ~/bin ]] || \ - export PATH=~/bin${PATH:+:$PATH} +# Now make sure $HOME/bin is top of the list (or at least present) +if [ -d $HOME/bin ]; then + [[ "$PATH" =~ "(^|:)$HOME/bin($|:)" ]] || \ + export PATH=$HOME/bin${PATH:+:$PATH} fi + +# Last, make sure to end MANPATH with a ':' to force include of system paths +# (some versions of man take care of this, but it doesn't hurt to have it +# anyway) +[[ "$MANPATH" =~ ":$" ]] || export MANPATH=$MANPATH: