University of Oregon

Personal tools

.bash profile

The .bash_profile script is run every time you log on to a Linux computer and sets up environment variables necessary for use of a variety of programs, including FSL, AFNI and FreeSurfer. We maintain a standard .bash_profile that is suited for use by most researchers, this is stored at /etc/skel/.bash_profile on all Center machines. From time to time, we will make changes to this script to accommodate new software. These changes are announced on the lcni-users list. To check the version of your .bash_profile, run the command:

grep -e 'BASH_PROFILE_VERSION=' ~/.bash_profile

This can be compared to the latest version by running the command:

grep -e 'BASH_PROFILE_VERSION=' /etc/skel/.bash_profile

To make use of these changes, you will need to update your copy of .bash_profile. First, log on to one of the Center Linux machines, then run the following commands:

cd
cp /etc/skel/.bash_profile .

Then log out and back in to activate the new script.

The following is a typical .bash_profile script. You are free to edit according to your needs, though in most cases, the default .bash_profile is suitable. If you are unfamiliar with bash scripting, or just want some advice on modifications, LCNI staff are available to help.

#	This is the default standard profile provided to a user.
#	They are expected to edit it to meet their own needs.

BASH_PROFILE_VERSION=1.14-20150322

echo ".bash_profile version ${BASH_PROFILE_VERSION}"

MAIL=/usr/mail/${LOGNAME:?}
PATH=${PATH}:/usr/local/bin

umask 007

# Not done by default in Debian, adds color to terminal.
if [ -e /etc/bash.bashrc ]; then
  . /etc/bash.bashrc
fi

# This bit is coming back into use with the installation
# of Son of Grid Engine.
if [ -d /opt/sge/default ]; then
  . /opt/sge/default/common/settings.sh
fi

# Check for NeuroDebian-style installation of FSL.
if [ -e /etc/fsl/fsl.sh ]; then
  . /etc/fsl/fsl.sh
  export FSLPARALLEL=1
  echo "==> FSL is installed ..."
elif [ -d /usr/local/packages/fsl ]; then
  echo "==> FSL versions available:"
  vers2=$(for ver in $(module avail fsl 2>&1 | grep fsl)
  do
    echo -n "${ver}\n"
  done)
  echo -e ${vers2} | sort
  echo
else
  echo "FSL is not installed"
fi

# Freesurfer is always installed in /usr/local, at least
# until it is in the NeuroDebian repository.
if [ -d /usr/local/freesurfer ]; then
  export FREESURFER_HOME="/usr/local/freesurfer"
  . $FREESURFER_HOME/SetUpFreeSurfer.sh
  export FIX_VERTEX_AREA
  echo "==> Welcome to FreeSurfer ... "
else
  echo "FreeSurfer is not installed"
fi

# 4dfp scripts conflict with and improve on those of
# freesurfer, so this must come after freesurfer setup
if [ -d /usr/local/4dfp ]; then
  export PATH=/usr/local/4dfp:${PATH}
  export RELEASE=/usr/local/4dfp
  export REFDIR=${RELEASE}/refdir
fi

if [ -x /usr/bin/mricron ]; then
  echo "==> MRIcron is installed ... mricron"
elif [ -d /usr/local/mricron ]; then
  export PATH=${PATH}:/usr/local/mricron
  echo "==> MRIcron is installed ... mricron"
else
  echo "MRIcron is not installed"
fi

if [ -x /usr/bin/caret5 ]; then
  echo "==> CARet is installed ... caret5"
elif [ -d /usr/local/caret ]; then
  export PATH=${PATH}:/usr/local/caret/bin
  echo "==> CARet is installed ... caret5"
else
  echo "CARet is not installed"
fi

if [ -d /usr/share/afni ]; then
  echo "==> AFNI is installed"
elif [ -d /usr/local/afni ]; then
  export PATH=${PATH}:/usr/local/afni:/usr/local/afni/SUMA_bin
  echo "==> AFNI is installed ... "
else
  echo "AFNI is not installed"
fi

if [ -d /home-local/lcmodel ]; then
  echo "==> LCModel is installed"
  top=$(set | grep DISPLAY | cut -f2 -d':')
  export DISPLAY=127.0.0.1:${top}
fi