annotate .bashrc @ 186:fc1b16130961

csing-related tweaks
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Thu, 15 Feb 2024 22:31:43 +0000
parents dfb88dee52b8
children
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'
182
dfb88dee52b8 tab completion fix
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 180
diff changeset
50
dfb88dee52b8 tab completion fix
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 180
diff changeset
51 # fix $W -> \$W after tab completion
dfb88dee52b8 tab completion fix
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 180
diff changeset
52 shopt -u progcomp
dfb88dee52b8 tab completion fix
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 180
diff changeset
53
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
54 fi
61
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
55
170
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
56 if [ -z "$TERMINFO" ]
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
57 then
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
58 export TERMINFO=/usr/share/terminfo
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
59 # needed to allow tmux to work
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
60 fi
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
61
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
62 EDITOR=emacs
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
63
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
64 WSHARED=/work/dc007/dc007/shared
170
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
65 W=/work/dc007/dc007/hst
61
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
66
180
4cb5cc893003 add private work bin dir to PATH
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 170
diff changeset
67 PATH=$PATH:$HOME/.local/bin:$HOME/bin:$W/bin:$WSHARED/bin
157
cac9586291ad no more gentoo,
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 153
diff changeset
68
170
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
69 export PATH EDITOR PS1 WSHARED W USER_PROMPT_COMMAND
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 157
diff changeset
70 export -f prompt savehist
180
4cb5cc893003 add private work bin dir to PATH
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 170
diff changeset
71 module load tmux