annotate .bashrc @ 0:bb5f1ea6cc5e

getting started
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 18 Jul 2022 18:50:26 +0100
parents
children 763bf32dfb26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 # .bashrc
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2
bb5f1ea6cc5e getting started
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:
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 # export SYSTEMD_PAGER=
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
6 # Login for singularity
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
7 # Source global definitions
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
8
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
9 if [ -f /etc/bashrc ]; then
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
10 # This is protected against running twice...
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
11 . /etc/bashrc
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
12 fi
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
13
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
14
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
15 savehist ()
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
16 {
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
17 hc=$(history 1 | tr -d '\n' | cut -d ' ' -f 2);
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
18 if [ $((hc % ${HIST_FREQ-10})) = 0 ]; then
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
19 history -a;
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
20 fi
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
21 }
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
22
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
23 prompt ()
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
24 {
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
25 savehist
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
26 echo -ne '\033]0;'${HOSTNAME/-login/} ${PWD/$HOME/w\~}'\007'
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
27 }
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
28
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
29 if [ "$PS1" ]; then
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
30 echo "Singularity bash" 1>&2
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
31 # don't put duplicate lines or lines starting with space in the history.
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
32 # See bash(1) for more options
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
33 export HISTCONTROL=ignoreboth
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
34
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
35 # append to the history file, don't overwrite it
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
36 shopt -s histappend
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
37
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
38 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
39 export HISTSIZE=3000
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
40 export HISTFILESIZE=6000
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
41 export HISTIGNORE='[ ]*:&:[fb]g:exit'
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
42 fi
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
43
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
44 #export PYTHONPATH=$HOME/lib/python3.6/site-packages
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
45
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
46 EDITOR=emacs
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
47
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
48 PATH=$PATH:$HOME/.local/bin:$HOME/bin
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
49
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
50 HHOME=/home/dc007/dc007/$(whoami)
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
51
bb5f1ea6cc5e getting started
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
52 export PATH EDITOR HHOME