From 579555e47045e30715cfec7b4955ccb6babae52f Mon Sep 17 00:00:00 2001 From: short <> Date: Wed, 26 Sep 2001 00:12:40 +0000 Subject: [PATCH] Fixed bug where LD_LIBRARY_PATH (and others) could start with empty element Code cleanup by using common _bash_profile_addpath() --- .bash_profile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.bash_profile b/.bash_profile index 16e7552..4f2ade9 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,22 +1,22 @@ -if [ -d $HOME/bin ];then export PATH=$HOME/bin:$PATH ;fi -if [ -d $HOME/netpbm/bin ];then export PATH=$HOME/netpbm/bin:$PATH ;fi -if [ -d $HOME/netpbm/lib ];then export LD_LIBRARY_PATH=$HOME/netpbm/lib ;fi -if [ -d $HOME/pgp5/bin ];then export PATH=$HOME/pgp5/bin:$PATH ;fi -if [ -d $HOME/step/pgsql/bin ];then export PATH=$HOME/step/pgsql/bin:$PATH ;fi -if [ -d $HOME/lib ];then export LD2LIBRARY_PATH=$HOME/lib ;fi -if [ -d $HOME/lib ];then export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib ;fi -if [ -d $HOME/man ];then export MANPATH=$HOME/man:$MANPATH ;fi -if [ -d $HOME/netpbm/man ];then export MANPATH=$HOME/netpbm/man:$MANPATH ;fi -if [ -d $HOME/pgp5/man ];then export MANPATH=$HOME/pgp5/man:$MANPATH ;fi -if [ -d $HOME/step/pgsql/man ];then export MANPATH=$HOME/step/pgsql/man:$MANPATH ;fi -if [ -d $HOME/step/pgsql ];then - export POSTGRESHOME=$HOME/step/pgsql - export PGLIB=$POSTGRESHOME/lib - export PGDATA=$POSTGRESHOME/data -fi +function _bash_profile_addpath # variable,dirpathname +{ + if [ '!' -d "$2" ];then return;fi + if [ -z "`eval "echo \\${$1}"`" ];then + eval "$1='$2'" + else + eval "$1=\"\${$1}:$2\"" + fi + export "$1" +} + +_bash_profile_addpath PATH "$HOME/bin" +_bash_profile_addpath LD_LIBRARY_PATH "$HOME/lib" +_bash_profile_addpath MANPATH "$HOME/man" +_bash_profile_addpath PERLLIB "$HOME/lib/perl5/site_perl" +_bash_profile_addpath PERLLIB "$HOME/lib/perl5/site_perl/`perl -V:version|cut -d "'" -f 2`" + export IGNOREEOF=10 export TMOUT=900 -export PERLLIB="$HOME/lib/perl5/site_perl:$HOME/lib/perl5/site_perl/5.6.0" export EDITOR='vim' export LC_CTYPE=cs_CZ.ISO-8859-2 export BASH_ENV="$HOME/.bashrc";source "$BASH_ENV" -- 1.8.3.1