Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created April 23, 2018 08:45
Show Gist options
  • Save informationsea/3eaaba4bf159dd53c0796fc20e170cdd to your computer and use it in GitHub Desktop.
Save informationsea/3eaaba4bf159dd53c0796fc20e170cdd to your computer and use it in GitHub Desktop.
configure environment variables
function add_path() {
if [ ! -d $1 ];then
return
fi
NEWPREFIX=$1
case ":$PATH:" in
*":$NEWPREFIX/bin:"*) return;;
esac
if [ -d ${NEWPREFIX}/bin ];then
export PATH=${NEWPREFIX}/bin:$PATH
fi
if [ "$LD_LIBRARY_PATH" ];then
export LD_LIBRARY_PATH=${NEWPREFIX}/lib64:${NEWPREFIX}/lib:$LD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=${NEWPREFIX}/lib64:${NEWPREFIX}/lib
fi
if [ "$PKG_CONFIG_PATH" ];then
export PKG_CONFIG_PATH=${NEWPREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH
else
export PKG_CONFIG_PATH=${NEWPREFIX}/lib/pkgconfig
fi
if [ "$MANPATH" ];then
export MANPATH=${NEWPREFIX}/share/man:$MANPATH
else
export MANPATH=${NEWPREFIX}/share/man:/usr/share/man:/user/local/share/man:/usr/X11/man
fi
if [ -f ${NEWPREFIX}/bin/virtualenvwrapper_lazy.sh ];then
source ${NEWPREFIX}/bin/virtualenvwrapper_lazy.sh
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment