# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

configure_ecearth()
{
  if [ `hostname` != "frontal1" ]; then
    echo "First, we move to frontal1..."
    touch .configure_ecearth
    ssh frontal1
  fi
  export EC_DEP=/projects/acad/ecearth/opt
  if [ -f $EC_DEP/modules.load ]; then
    source $EC_DEP/modules.load
  fi
}

# User specific aliases and functions
if [ `hostname` = "frontal1" ]; then
  [[ -f .configure_ecearth ]] && configure_ecearth
  [[ -f .configure_ecearth ]] && rm .configure_ecearth
fi

# Path/variables
# --------------
export HOST=`uname -n`
export HISTFILESIZE=6000
export HISTSIZE=6000

# Display
# -------
export PS1="\[\033[1;39m\]\u@\h\[\033[0;0m\] \t \[\033[0;34m\]\w \[\033[2;31m\]\# \[\033[0;0m\]> "

# alias
# -----
if [ `uname` = "Linux" ] ; then
 alias df='df -hT'
 alias ls='ls --color -F'
 alias lo='ls -oh -F'
 alias cpa="cp -a"
 alias ps="ps --forest"
else
 alias df='df -k'
 alias ls='ls -F'
 alias lo='ls -o -F'
 alias cpa="cp -rf"
fi

alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"

alias cd..="cd .."
alias dc="cd"

alias la='ls -a -o -F -l'
alias sl='ls'
alias l='ls -lh'
alias ll='ls -o -F'
alias lt='ls -l -s -t |more'
alias m="less"
alias h="history"

# Personal modules variables
# --------------------------
if [ `hostname` = "frontal3" ]; then
  PATH="/projects/acad/ecearth/opt/apps/lua/lua/bin:$PATH"
  . /projects/acad/ecearth/opt/lmod/lmod/init/profile
  ulimit -u 8192
  export OMP_NUM_THREADS=2
fi