annotate .bashrc @ 157:cac9586291ad

no more gentoo, split out functions into .bash_extras
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 04 Jul 2022 18:14:41 +0100
parents 2b59f3ef2294
children b41425a5e2f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 # .bashrc
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
3 # Uncomment the following line if you don't like systemctl's auto-paging feature:
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 # export SYSTEMD_PAGER=
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
6 # Source global definitions
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
7
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
8 if [ -f /etc/bashrc ]; then
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
9 # This is protected against running twice...
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
10 . /etc/bashrc
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
11 fi
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
12
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
13 . ~/.bash_extras
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
14
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
15 savehist ()
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
16 {
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
17 hc=$(history 1 | tr -d '\n' | cut -d ' ' -f 2);
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
18 if [ $((hc % ${HIST_FREQ-10})) = 0 ]; then
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
19 history -a;
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
20 fi
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
21 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
22
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
23 prompt ()
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
24 {
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
25 savehist
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
26 echo -ne '\033]0;'${HOSTNAME/-login/} ${PWD/$HOME/\~}'\007'
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
27 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
28
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
29 if [ "$PS1" ]; then
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
30 PS1='\[\033[1m\]\h\[\033[0m\]<\!>: '
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
31 # LD_LIBRARY_PATH=/home/dc007/dc007/hst/lib64 gdb >/dev/null 2>&1 <<EOF
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
32 # attach $$
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
33 # call (int) unbind_variable("tt")
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
34 # detach
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
35 # quit
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
36 # EOF
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
37 USER_PROMPT_COMMAND=prompt
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
38 echo "Vanilla bashrc" 1>&2
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
39 # don't put duplicate lines or lines starting with space in the history.
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
40 # See bash(1) for more options
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
41 # export HISTCONTROL=ignoreboth
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
42
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
43 # append to the history file, don't overwrite it
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
44 shopt -s histappend
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
45
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
46 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
47 # export HISTSIZE=3000
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
48 export HISTFILESIZE=6000
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
49 export HISTIGNORE='[ ]*:&:[fb]g:exit'
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
50 fi
61
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
51
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
52 EDITOR=emacs
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
53
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
54 WSHARED=/work/dc007/dc007/shared
61
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
55
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
56 PATH=$PATH:$HOME/.local/bin:$HOME/bin:$WSHARED/bin
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
57
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
58 export PATH EDITOR PS1 WSHARED USER_PROMPT_COMMAND