# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
	if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
	   if [ "$2" = "after" ] ; then
	      PATH=$PATH:$1
	   else
	      PATH=$1:$PATH
	   fi
	fi
}

# For Intel compilers
INTEL=/opt/intel/compiler50/ia32

# For PGI compilers
PGI=/opt/pgi
PGIBIN=/opt/pgi/linux86/bin

# For FLEX-lm
LM_LICENSE_FILE="/opt/pgi/licenses.dat"

# Path manipulation
if [ `id -u` = 0 ]; then
	pathmunge /sbin
	pathmunge /usr/sbin
	pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after
pathmunge $INTEL/bin after
pathmunge $PGI/linux86/bin after
pathmunge /usr/local/intel/bin after

test -f $INTEL/bin/iccvars.sh && source $INTEL/bin/iccvars.sh

unset pathmunge

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi


export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC INTEL LM_LICENSE_FILE

export MANPATH="`manpath`:/opt/intel/compiler70/man:/usr/pbs/man:/opt/pgi/man" 

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
    	. $i
    fi
done

unset i
