Mercurial > hg > cc > cirrus_home
annotate .bashrc @ 115:2bcf31c52c14
include sh-script
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Tue, 15 Jun 2021 16:58:03 +0000 |
parents | bcea0410143c |
children | 9de06ae73372 |
rev | line source |
---|---|
0 | 1 # .bashrc |
2 | |
112 | 3 export G=${HOME}/gentoo |
0 | 4 # Uncomment the following line if you don't like systemctl's auto-paging feature: |
5 # export SYSTEMD_PAGER= | |
6 | |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
7 if [ $SHELL = "/bin/bash" ] |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
8 then |
112 | 9 # Vanilla Cirrus login |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
10 # Source global definitions |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
11 if [ -f /etc/bashrc ]; then |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
12 . /etc/bashrc |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
13 fi |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
14 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
15 if [ "$PS1" ]; then |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
16 PS1='\[\033[1m\]\h\[\033[0m\]<\!>: ' |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
17 echo "Vanilla bashrc" 1>&2 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
18 # don't put duplicate lines or lines starting with space in the history. |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
19 # See bash(1) for more options |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
20 # export HISTCONTROL=ignoreboth [readonly on Cirrus :-[ |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
21 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
22 # append to the history file, don't overwrite it |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
23 shopt -s histappend |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
24 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
25 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
26 # export HISTSIZE=3000 [readonly on Cirrus :-[ |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
27 export HISTFILESIZE=6000 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
28 fi |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
29 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
30 module load gcc # assumed by Prefix |
112 | 31 module load gnu-parallel |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
32 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
33 export PYTHONPATH=$HOME/lib/python3.6/site-packages |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
34 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
35 PATH="/lustre/home/dc007/hst/lib/perl5/bin${PATH:+:${PATH}}"; export PATH; |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
36 PERL5LIB="/lustre/home/dc007/hst/lib/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
37 PERL_LOCAL_LIB_ROOT="/lustre/home/dc007/hst/lib/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
38 PERL_MB_OPT="--install_base \"/lustre/home/dc007/hst/lib/perl5\""; export PERL_MB_OPT; |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
39 PERL_MM_OPT="INSTALL_BASE=/lustre/home/dc007/hst/lib/perl5"; export PERL_MM_OPT; |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
40 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
41 export ANT_HOME=$HOME/src/apache-ant-1.10.7 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
42 export MAVEN_HOME=$HOME/src/apache-maven-3.6.3 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
43 export JAVA_HOME=$HOME/lib/openjdk-8u252-b09 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
44 export PATH=${PATH}:${ANT_HOME}/bin:${MAVEN_HOME}/bin |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
45 |
112 | 46 EDITOR=emacs |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
47 else |
112 | 48 # gentoo |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
49 if [ "$PS1" ]; then |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
50 echo "~/.bashrc inside gentoo" 1>&2 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
51 PS1='\[\e[1;32m\]\h\[\e[0m\]<\!>: ' |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
52 # Source some global definitions? |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
53 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
54 # These are readonly under Cirrus, so repeated here where they work1 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
55 export HISTCONTROL=ignoreboth |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
56 export HISTSIZE=3000 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
57 export HISTFILESIZE=6000 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
58 shopt -s histappend |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
59 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
60 if [ "$DISPLAY" ] |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
61 then |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
62 xrdb $HOME/.Xresources |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
63 fi |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
64 fi |
112 | 65 EDITOR=xemacs |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
66 fi |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
67 |
0 | 68 # User specific aliases and functions |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
69 #module add gnu-parallel |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
70 #export N1=rli4n35 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
71 #export N2=rli6n35 |
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
72 #export NN="$N1 $N2" |
0 | 73 |
74 # Tools | |
75 function lss() { | |
76 /bin/ls -l "$@" | sort -nr -k 5,5 | |
77 } | |
78 | |
79 function sus() { | |
80 sort "$@" | uniq -c | sort -k1nr,1 | |
81 } | |
82 | |
83 function tot () | |
84 { | |
85 awk '{sum+=$1} END {printf "%u\n",sum}' | |
86 } | |
87 | |
88 btot () | |
89 { | |
90 python3 -c 'import sys | |
91 n=0 | |
92 for l in sys.stdin: | |
93 n+=int(l) | |
94 print(n) | |
95 ' | |
96 } | |
97 | |
112 | 98 function uz () { $G/usr/bin/igzip -dc "$@" ; } |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
99 |
0 | 100 function typecat () |
101 { | |
102 tt=$(type $1) | |
103 case $tt in | |
104 *\ is\ hashed\ *) cat $(echo $tt | cut -f 4 -d ' ' | tr -d '()') ;; | |
105 *\ is\ /*) cat $(echo $tt | cut -f 3 -d ' ' | tr -d '()') ;; | |
106 *) type $1 ;; | |
107 esac | |
108 } | |
83
8fb11e337e23
environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
61
diff
changeset
|
109 #export HISTSIZE=3000 |
61 | 110 |
111 PATH=$PATH:$HOME/.local/bin:$HOME/bin | |
112 | |
112 | 113 export PATH EDITOR PS1 G |