annotate nobuild/dot-bashrc @ 124:46e6dd7dce2e

Beginnings of some documentation, and miscellaneous tweaks.
author David Bryant <bagnose@gmail.com>
date Thu, 05 May 2011 00:04:41 +0930
parents
children 9a9dcae45e08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
124
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
1 # ~/.bashrc: executed by bash(1) for non-login shells.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
3 # for examples
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
4
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
5 # If not running interactively, don't do anything
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
6 [ -z "$PS1" ] && return
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
7
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
8 # don't put duplicate lines in the history. See bash(1) for more options
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
9 # ... or force ignoredups and ignorespace
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
10 HISTCONTROL=ignoredups:ignorespace
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
11
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
12 # append to the history file, don't overwrite it
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
13 shopt -s histappend
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
14
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
15 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
16 HISTSIZE=1000
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
17 HISTFILESIZE=2000
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
18
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
19 # check the window size after each command and, if necessary,
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
20 # update the values of LINES and COLUMNS.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
21 shopt -s checkwinsize
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
22
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
23 # make less more friendly for non-text input files, see lesspipe(1)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
24 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
25
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
26 # set variable identifying the chroot you work in (used in the prompt below)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
27 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
28 debian_chroot=$(cat /etc/debian_chroot)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
29 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
30
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
31 # set a fancy prompt (non-color, unless we know we "want" color)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
32 case "$TERM" in
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
33 xterm-color) color_prompt=yes;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
34 esac
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
35
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
36 # uncomment for a colored prompt, if the terminal has the capability; turned
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
37 # off by default to not distract the user: the focus in a terminal window
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
38 # should be on the output of commands, not on the prompt
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
39 force_color_prompt=yes
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
40
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
41 if [ -n "$force_color_prompt" ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
42 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
43 # We have color support; assume it's compliant with Ecma-48
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
44 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
45 # a case would tend to support setf rather than setaf.)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
46 color_prompt=yes
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
47 else
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
48 color_prompt=
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
49 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
50 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
51
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
52 if [ "$color_prompt" = yes ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
53 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
54 else
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
55 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
56 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
57 unset color_prompt force_color_prompt
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
58
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
59 # If this is an xterm set the title to user@host:dir
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
60 case "$TERM" in
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
61 xterm*|rxvt*)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
62 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
63 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
64 *)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
65 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
66 esac
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
67
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
68 # enable color support of ls and also add handy aliases
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
69 if [ -x /usr/bin/dircolors ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
70 test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
71 alias ls='ls --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
72 #alias dir='dir --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
73 #alias vdir='vdir --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
74
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
75 alias grep='grep --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
76 alias fgrep='fgrep --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
77 alias egrep='egrep --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
78 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
79
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
80 # some more ls aliases
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
81 #alias ll='ls -alF'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
82 #alias la='ls -A'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
83 #alias l='ls -CF'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
84
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
85 # Add an "alert" alias for long running commands. Use like so:
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
86 # sleep 10; alert
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
87 alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
88
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
89 # Alias definitions.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
90 # You may want to put all your additions into a separate file like
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
91 # ~/.bash_aliases, instead of adding them here directly.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
92 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
93
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
94 if [ -f ~/.bash_aliases ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
95 . ~/.bash_aliases
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
96 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
97
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
98 # enable programmable completion features (you don't need to enable
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
99 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
100 # sources /etc/bash.bashrc).
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
101 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
102 . /etc/bash_completion
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
103 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
104
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
105 alias mv='mv -i'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
106 alias cp='cp -i'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
107 alias ls='ls --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
108 alias grep='grep --color=auto'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
109 #alias w2do='w2do --colour'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
110 alias word='wine /home/daveb/.wine/drive_c/Program\ Files/Microsoft\ Office/OFFICE11/WINWORD.EXE > /dev/null 2>&1'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
111 alias mr='mr -ptq'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
112
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
113 setup_local() {
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
114 local LOCAL=$1
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
115 shift
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
116 PATH="${LOCAL}/bin:${PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
117
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
118 for i in $*; do
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
119 case "$i" in
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
120 pk)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
121 export PKG_CONFIG_PATH="${LOCAL}/lib/pkgconfig:${PKG_CONFIG_PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
122 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
123 ld)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
124 export LD_LIBRARY_PATH="${LOCAL}/lib:${LD_LIBRARY_PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
125 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
126 py)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
127 export PYTHONPATH="${LOCAL}/lib/python2.6/site-packages:${PYTHONPATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
128 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
129 ac)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
130 export ACLOCAL_FLAGS="-I ${LOCAL}/share/aclocal ${ACLOCAL_FLAGS}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
131 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
132 *)
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
133 echo "Unhandled flag in setup_local: $i"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
134 ;;
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
135 esac
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
136 done
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
137 }
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
138
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
139 setup_local "${HOME}/local/inkscape" ld
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
140 #setup_local "${HOME}/local/wine"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
141 #setup_local "${HOME}/local/gimp"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
142 #setup_local "/opt/acacia/ace"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
143 #setup_local "${HOME}/local/gstreamer"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
144 #setup_local "${HOME}/local/e"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
145 #setup_local "/opt/acacia/legacy/aesop"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
146 #setup_local "/opt/acacia/legacy/eugene-1.0"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
147 #setup_local "/opt/acacia/legacy/scimers"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
148 PATH="${HOME}/source/d/dmd/bin:${PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
149 #PATH="/opt/Adobe/Reader9/bin:${PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
150
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
151 export EDITOR="vim"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
152 #export CC="colorgcc"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
153
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
154 # ACE/TAO support
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
155
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
156 #export ACE_ROOT="/opt/acacia/ace"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
157 #export TAO_ROOT="${ACE_ROOT}/TAO"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
158 #export LD_LIBRARY_PATH="${ACE_ROOT}/lib:${LD_LIBRARY_PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
159 #export CPATH="${ACE_ROOT}/include"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
160 #PATH="${ACE_ROOT}/bin:${PATH}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
161
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
162 # Android support
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
163 #PATH=${PATH}:${HOME}/android-sdk-linux_86/tools
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
164
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
165 #
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
166 # Functions
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
167 #
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
168
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
169 # Support for setting the title of the terminal tab
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
170 # This is broken:
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
171 function title() {
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
172 unset PROMPT_COMMAND
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
173 echo -ne "\033]0;$1\007"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
174 }
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
175
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
176 function real_loc() {
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
177 find $* \( \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
178 -name \*.d -o \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
179 -name \*.h -o -name \*.cxx -o -name \*.C -o \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
180 -name \*.c -o -name \*.cc -o -name \*.idl -o \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
181 -name \*.cpp -o -name \*.java -o -name \*.ipc -o \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
182 -name \*.hpp \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
183 \) \
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
184 -print0 | xargs --null cat | grep -v "^$" | wc -l
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
185 }
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
186
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
187 function loc() {
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
188 if [ $# -eq 0 ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
189 real_loc "."
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
190 else
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
191 real_loc $*
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
192 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
193 }
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
194
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
195 # Output a copy of $1 with duplicates removed
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
196 # Note: subsequent copies are removed, otherwise order is preserved.
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
197 # 1. the path to remove duplicates from
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
198 function remove_duplicates() {
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
199 local original="${1}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
200 local IFS=':'
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
201 local result=""
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
202 for item in ${original}; do
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
203 if [ -z "$item" ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
204 continue
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
205 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
206 local -i found_existing=0
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
207 for existing in ${result}; do
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
208 if [ "${item}" == "${existing}" ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
209 found_existing=1
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
210 break 1
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
211 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
212 done
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
213 if [ ${found_existing} -eq 0 ]; then
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
214 result="${result:+${result}:}${item}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
215 fi
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
216 done
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
217 echo "${result}"
46e6dd7dce2e Beginnings of some documentation, and miscellaneous tweaks.
David Bryant <bagnose@gmail.com>
parents:
diff changeset
218 }