bash Notes


Here is my .bash_profile
   # .bash_profile
   # Get the aliases and functions
   if [ -f ~/.bashrc ]; then
      . ~/.bashrc
      unalias ls
      unalias vi
   fi

   # User specific environment and startup programs

   export PATH=$PATH:$HOME/bin
   unset USERNAME

And this is my .bashrc
   # .bashrc
   # User specific aliases and functions
   # alias rm='rm -i'
   # alias cp='cp -i'
   # alias mv='mv -i'

   set -o vi
   alias c=clear
   alias web=firefox

   # Source global definitions
   if [ -f /etc/bashrc ]; then
      . /etc/bashrc
   fi
   export PATH=$PATH:/opt/VRTS/bin:/opt/VRTSob/bin

   unset PROMPT_COMMAND
   export PS1="\[\033]0;\u@\h: \w\007\]\w \\\$ "

These are the profile scripts and the order they're called when

Logging In                Comments
============          ==========================================================
/etc/profile          If this is a login shell, then calls all the
                      /etc/profile.d/*.sh scripts.
/etc/profile.d/*.sh   Interesting scripts are colorls.sh and vim.sh (yuk!).
                      See my color notes file to see what I
                      know about Linux's color-ized ls command.
~/.bash_profile       Which calls ~/.bashrc
~/.bashrc             Which calls /etc/bashrc
/etc/bashrc           Sets default umask


Note this is slightly different when you're running bash from other than a
login shell, e.g. you're opening up another xterm window or running a script.


For testing, as root, I
  cp -p /etc/profile /etc/raj.profile
  cp -p /etc/bashrc /etc/raj.bashrc
  cp -p /etc/profile.d/colorls.sh ~/save.colorls.sh
  cp -p /etc/profile.d/less.sh    ~/save.less.sh
  cp -p /etc/profile.d/vim.sh     ~/save.vim.sh
  cp -p ~/.bashrc ~/save.bashrc
  chsh -s /bin/bash jasper

vi /etc/profile /etc/profile.d/colorls.sh /etc/profile.d/less.sh /etc/profile.d/vim.sh

As jasper, I
  cp -p ~/.profile save.profile
  cp -p ~/.kshrc   save.kshrc

 - - - - - - - - - - - - - - - - - - - - - - - - - - - -

To restore, as root,
  cp -p /etc/raj.profile /etc/profile
  cp -p /etc/raj.bashrc /etc/bashrc
  cp -p ~/save.colorls.sh /etc/profile.d/colorls.sh
  cp -p ~/save.less.sh    /etc/profile.d/less.sh
  cp -p ~/save.vim.sh     /etc/profile.d/vim.sh
  cp -p ~/save.bashrc ~/.bashrc
  chsh -s /bin/ksh jasper

As jasper,
  cp -p ~/save.profile ~/.profile
  cp -p ~/save.kshrc   ~/.kshrc

 - - - - - - - - - - - - - - - - - - - - - - - - - - - -

When you're really all done, as root,
  cp -p /etc/raj.profile /etc/profile
  cp -p /etc/raj.bashrc /etc/bashrc
  cp -p ~/save.colorls.sh /etc/profile.d/colorls.sh
  cp -p ~/save.less.sh    /etc/profile.d/less.sh
  cp -p ~/save.vim.sh     /etc/profile.d/vim.sh
  cp -p ~/save.bashrc ~/.bashrc
  chsh -s /bin/ksh jasper

  rm -f /etc/raj.profile /etc/raj.bashrc
  rm -f ~/save.colorls.sh ~/save.less.sh ~/save.vim.sh ~/save.bashrc

As jasper,
  cp -p ~/save.profile ~/.profile
  cp -p ~/save.kshrc   ~/.kshrc

  rm -f ~/save.profile ~/save.kshrc