#!/bin/bash # .bashrc-ni #------------------------------------------------------------------------------# # $Id: .bashrc-ni,v 1.6 2004/02/26 21:52:05 collean Exp $ #------------------------------------------------------------------------------# # # This script is designed to be run at startup by non-interactive shells. To do # that, make sure BASH_ENV=$HOME/.bashrc-ni when starting such a shell. # # This script is also designed to be called by .bashrc (by interactive shells # at their startup) to set the necessary environment variables, including PATH # and LD_LIBRARY_PATH. # #------------------------------------------------------------------------------# # Uncomment the following when tracing shell startup # echo ".bashrc-ni run by $$ at `date +'%Y%m%d-%H:%M:%S'`" >> $HOME/suslog #------------------------------------------------------------------------------# # BEGIN "if-def wrap" #------------------------------------------------------------------------------# if [ "$BASHRC_NI_DONE" != "$$" ] ; then export BASHRC_NI_DONE="$$" # Uncomment the following when tracing shell startup # echo "... $$ setting BASHRC_NI_DONE to $BASHRC_NI_DONE" >> $HOME/suslog # this is in case you really need to rerun this (e.g. after modifying it) function resetbni { export BASHRC_NI_DONE="" } #------------------------------------------------------------------------------# # If add_to_path, add_to_libp, and add_to_manp are not defined elsewhere, # uncomment them here #------------------------------------------------------------------------------# # #------------------------------------------------------------------------------# # add_to_path adds the argument to the path if it is not already in the path #------------------------------------------------------------------------------# function add_to_path { if [ -z "$PATH" ]; then export PATH=$1 elif ! `echo $PATH | grep -q $1` ; then export PATH=$1:$PATH fi } #------------------------------------------------------------------------------# # add_to_libp adds the argument to LD_LIBRARY_PATH if it is not already there #------------------------------------------------------------------------------# function add_to_libp { if [ -z "$LD_LIBRARY_PATH" ]; then export LD_LIBRARY_PATH=$1 elif ! `echo $LD_LIBRARY_PATH | grep -q $1` ; then export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH fi } #------------------------------------------------------------------------------# # add_to_manp adds the argument to MANPATH if it is not already there #------------------------------------------------------------------------------# function add_to_manp { if [ -z "$MANPATH" ]; then if which manpath > /dev/null ; then export MANPATH=$1:`manpath` else export MANPATH=$1 fi elif ! `echo $MANPATH | grep -q $1` ; then export MANPATH=$1:$MANPATH fi } #------------------------------------------------------------------------------# # Force current directory into beginning of path #------------------------------------------------------------------------------# export PATH=.:$PATH #------------------------------------------------------------------------------# # Private setup #------------------------------------------------------------------------------# if [ -f $HOME/.bashrc-ni-private ] ; then . $HOME/.bashrc-ni-private fi #------------------------------------------------------------------------------# # END "if-def wrap" #------------------------------------------------------------------------------# fi