view .bashrc @ 197:954d25f20123

Removing toodledo stuff (no longer used)
author Steve Huston <huston@srhuston.net>
date Wed, 30 Sep 2020 10:54:00 -0400
parents b2dc752234ae
children 6e7913283c7a
line wrap: on
line source

# $Id$
#
# This file is sourced for shells which are interactive but not a
# login shell; however, since it is also sourced within
# $HOME/.bash_profile, the end result is that this file is sourced for all
# shells.


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

# User specific aliases and functions
if [ -f $HOME/.bash_aliases ]; then
  . $HOME/.bash_aliases
fi

#
# Environment variables
#
#[[ "$PS1" ]] && export PS1='${debian_chroot:+($debian_chroot)}\e[01;32m\h\e[00m:\e[01;34m\w\e[00m\$ '
[[ "$PS1" ]] && {
  if [ -z "$DARWIN" ] ; then
    export PS1='${debian_chroot:+($debian_chroot)}\[\e[01;`case $EUID in 0) echo -n 31; ;; *) echo -n 32; ;; esac;`m\]\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ '
  else
    export PS1='${debian_chroot:+($debian_chroot)}\[\e[01;`case $EUID in 0) echo "31\c"; ;; *) echo -n 32; ;; esac;`m\]\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\$ '
  fi
}
export PAGER=less
export EDITOR=vim
export RUBYLIB=$HOME/Installs/rubygems/lib
export GEM_HOME=$HOME/Installs/rubygems/gems
export TOMENET_PATH=$HOME/Installs/tomenet/lib/
export HOST=`hostname -s`

if [ -f $HOME/.screen/$HOST ]; then
  export SCREENRC=$HOME/.screen/$HOST
fi

# If this is an xterm set the title to user@host:dir
case $TERM in
  xterm*|rxvt*)
    PROMPT_COMMAND='history -a ; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
  screen.xterm-256color)
    # Specifically, to hell with this one
    export TERM=screen
    # Copied from below because the Mac's bash doesn't grok ;& as a
    # passthrough
    PROMPT_COMMAND="history -a"
    ;;
  screen*)
    # But if it's a screen window, leave it alone please
    PROMPT_COMMAND="history -a"
    ;;
  *)
    ;;
esac

# Set some friendly options for history
# Append to ~/.bash_history, don't overwrite it
shopt -s histappend
# Set the history a bit larger, both on disk and in memory
export HISTFILESIZE=10000
export HISTSIZE=10000
# Ignore lines starting with a space, and duplicates of the previous command;
# also, if a line is a dupe from earlier history, remove the previous line
# entirely
export HISTCONTROL='ignoreboth:erasedups'
# Ignore some commonly used and not noteworthy commands
export HISTIGNORE='bg:fg:jobs:history:ret:rbh:rj:rx:keys:ssh-add*:jobs'
# Put a timestamp on history lines
export HISTTIMEFORMAT='%F %T '
# Fold multi-line commands into a single line
# This seems to be 'on' in many places already, but let's make sure
shopt -s cmdhist

#
# Paths
#

# A test for modules, to be implemented in time:
# if [ "`type -t module`" == "function" ]; then
#   module load foo
# fi

# Standard-ish paths; some of these may be in place already, but if
# they're not they should probably go near the front of the pack.
for P in /sbin /usr/sbin /usr/local/bin /usr/local/sbin \
  /opt/local/bin /opt/local/sbin /usr/X11R6/bin; do
  if [ -d $P ]; then
    [[ $PATH =~ (^|:)$P($|:) ]] || \
    export PATH=${P}${PATH:+:$PATH}
  fi
done

for M in /usr/local/share/man /usr/local/man /opt/local/share/man ; do
  if [ -d $M ]; then
    [[ $MANPATH =~ (^|:)$M($|:) ]] || \
    export MANPATH=${M}${MANPATH:+:$MANPATH}
  fi
done

# Local Perl install
if [ -d $HOME/perl ]; then
  if [ -d $HOME/perl/lib/perl5 ]; then
    [[ $PERL5LIB =~ (^|:)$HOME/perl/lib/perl5($|:) ]] || \
    export PERL5LIB=$HOME/perl/lib/perl5${PERL5LIB:+:$PERL5LIB}
  fi

  if [ -d $HOME/perl/lib64/perl5 ]; then
    [[ $PERL5LIB =~ (^|:)$HOME/perl/lib64/perl5($|:) ]] || \
    export PERL5LIB=$HOME/perl/lib64/perl5${PERL5LIB:+:$PERL5LIB}
  fi

  if [ -d $HOME/perl/lib/perl5/site_perl ]; then
    [[ $PERL5LIB =~ (^|:)$HOME/perl/lib/perl5/site_perl($|:) ]] || \
    export PERL5LIB=$HOME/perl/lib/perl5/site_perl${PERL5LIB:+:$PERL5LIB}
  fi

  if [ -d $HOME/perl/lib64/perl5/site_perl ]; then
    [[ $PERL5LIB =~ (^|:)$HOME/perl/lib64/perl5/site_perl($|:) ]] || \
    export PERL5LIB=$HOME/perl/lib64/perl5/site_perl${PERL5LIB:+:$PERL5LIB}
  fi

  if [ -d $HOME/perl/share/man ]; then
    [[ $MANPATH =~ (^|:)$HOME/perl/share/man($|:) ]] || \
    export MANPATH=$HOME/perl/share/man:${MANPATH:+$MANPATH}
  fi

  if [ -d $HOME/perl/bin ]; then
    [[ $PATH =~ (^|:)$HOME/perl/bin($|:) ]] || \
    export PATH=$HOME/perl/bin${PATH:+:$PATH}
  fi
fi

# Local install paths - install things to $HOME/Installs directories, and
# they will automatically get the proper paths added.  Most things
# that use autoconf will do this with
# './configure --prefix=$HOME/Installs'
for D in $HOME/Installs/* ; do
  if [ -d $D/bin ]; then 
    [[ $PATH =~ (^|:)$D/bin($|:) ]] || \
    export PATH=$D/bin${PATH:+:$PATH}
  fi

  if [ -d $D/share/man ]; then 
    [[ $MANPATH =~ (^|:)$D/share/man($|:) ]] || \
    export MANPATH=$D/share/man:${MANPATH:+$MANPATH}
  fi
  
  if [ -d $D/man ]; then 
    [[ $MANPATH =~ (^|:)$D/man($|:) ]] || \
    export MANPATH=$D/man:${MANPATH:+$MANPATH}
  fi
done

## Add-ons for Intel compilers at work, and Condor
#INTEL_ARCH=''
#case `uname -p` in
#  i[3456]86)
#    INTEL_ARCH="ia32"
#    ;;
#
#  x86_64)
#    INTEL_ARCH="intel64"
#    ;;
#esac
#[[ "$INTEL_ARCH" ]] && {
#  [[ $PATH =~ (^|:)/usr/peyton/intel ]] || {
#    [[ -f /usr/peyton/intel/11.0/bin/iccvars.sh ]] && \
#     . /usr/peyton/intel/11.0/bin/iccvars.sh $INTEL_ARCH
#    [[ -f /usr/peyton/intel/11.0/bin/ifortvars.sh ]] && \
#     . /usr/peyton/intel/11.0/bin/ifortvars.sh $INTEL_ARCH
#  }
#}

#if [ -f /u/condor/condor-setup.sh ]; then
#  [[ $PATH =~ (^|:)/u/condor/hosts/`hostname -s`/sbin($|:) ]] || {
#    export PATH=${PATH:+$PATH:}/u/condor/hosts/`hostname -s`/sbin
#    . /u/condor/condor-setup.sh
#  }
#fi

# Now make sure $HOME/bin is top of the list (or at least present)
if [ -d $HOME/bin ]; then
  [[ $PATH =~ (^|:)$HOME/bin($|:) ]] || \
  export PATH=$HOME/bin${PATH:+:$PATH}
fi

# Last, make sure to end MANPATH with a ':' to force include of system paths
# (some versions of man take care of this, but it doesn't hurt to have it
# anyway)
[[ $MANPATH =~ :$ ]] || export MANPATH=$MANPATH:

# Store MIBs in ~/mibs and they'll be added here.  Can nest directories
# (they'll be searched).
if [ -d $HOME/mibs ]; then
  for D in `find $HOME/mibs -type d` ; do
    [[ $MIBDIRS =~ (^\+|:)$D($|:) ]] || \
    export MIBDIRS=${MIBDIRS:+$MIBDIRS:}$D
  done

  [[ $MIBDIRS =~ ^\+ ]] || export MIBDIRS=+$MIBDIRS
  export MIBS=ALL
fi