Like everyone else in the universe, I have my own preferred bash setup. Discussed here is the setup I use with DreamHost.
UPDATE: See 1st comment below.
I'll start with the .bash_profile file as it simply references the .bashrc file:
# ~/.bash_profile: executed by bash(1) for login shells.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
(I've always done it this way -- never having a different config for login/non-login shells. YMMV.)
Now for the .bashrc file:
01: # ~/.bashrc: executed by bash(1) for non-login shells.
02:
03: umask 002
04:
05: export EDITOR=vi
06:
07: # The base drupal install location
08: if [ -e ~/webroot/drupal ]; then
09: export DRUPAL_INSTALL_ROOT=~/webroot/drupal
10: fi
11:
12: # changes to a drupal install site dir
13: dcd() { cd "`drupalReport.sh sitedir "$1"`"; }
14:
15: # pushd to a drupal install site dir
16: dpushd() { pushd "`drupalReport.sh sitedir "$1"`"; }
17:
18: # mysql into a drupal site db
19: dmysql() { mysql `drupalReport.sh dbconn "$1"`; }
20:
21: # Prompt
22: PS1="[\u@toddgee.com \W]\$ "
23:
24: alias cp='cp -i'
25: alias h='history'
26: alias ho='hostname'
27: alias j='jobs'
28: alias l='less'
29: alias l.='ls -d .* --color=auto'
30: alias ll='ls -lF --color=auto'
31: alias lll='ls -alF --color=auto'
32: alias ls='ls -F --color=auto'
33: alias m='more'
34: alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
35: alias mv='mv -i'
36: alias rm='rm -i'
37:
38: export PATH=$PATH`find -L ${HOME}/bin -type d | grep -v .svn | while read dir; do echo -n ":${dir}"; done; echo ""`
39:
40: # Call the drupal scripts library's 'bash_completion' file
41: DRUPAL_SCRIPT_DIR="`dirname "\`which drupalCVSDeploy.sh\`"`"
42: if [ -n "${DRUPAL_SCRIPT_DIR}" ] && [ -f "${DRUPAL_SCRIPT_DIR}/bash_completion" ]; then
43: . "${DRUPAL_SCRIPT_DIR}/bash_completion"
44: fi
45: unset DRUPAL_SCRIPT_DIR 46:
47: # Does local file exist?
48: if [ -f ~/.bashrc.local ]; then
49: . ~/.bashrc.local
50: fi
some notes about particular lines:
I also have a .bash_logout file that just kills any ssh_agent I may have running:
# ~/.bash_logout: executed by bash(1) upon exit.
# Kill ssh_agent if it's running
if [ -n "${SSH_AGENT_PID}" ]; then
kill "${SSH_AGENT_PID}"
fi
Comments
DreamHost Scripts Library
Note, this script and the rest of my DreamHost scripts are now available as part of my DreamHost Script Library