Mercurial > hg > cc > cirrus_home
comparison .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 |
comparison
equal
deleted
inserted
replaced
156:ace590c2fdfc | 157:cac9586291ad |
---|---|
1 # .bashrc | 1 # .bashrc |
2 | 2 |
3 export G=${HOME}/gentoo | |
4 # Uncomment the following line if you don't like systemctl's auto-paging feature: | 3 # Uncomment the following line if you don't like systemctl's auto-paging feature: |
5 # export SYSTEMD_PAGER= | 4 # export SYSTEMD_PAGER= |
6 | 5 |
7 if [ $SHELL = "/bin/bash" ] | 6 # Source global definitions |
8 then | |
9 # Vanilla Cirrus login | |
10 # Source global definitions | |
11 if [ -f /etc/bashrc ]; then | |
12 . /etc/bashrc | |
13 fi | |
14 | 7 |
15 if [ "$PS1" ]; then | 8 if [ -f /etc/bashrc ]; then |
16 PS1='\[\033[1m\]\h\[\033[0m\]<\!>: ' | 9 # This is protected against running twice... |
17 echo "Vanilla bashrc" 1>&2 | 10 . /etc/bashrc |
18 # don't put duplicate lines or lines starting with space in the history. | |
19 # See bash(1) for more options | |
20 # export HISTCONTROL=ignoreboth [readonly on Cirrus :-[ | |
21 | |
22 # append to the history file, don't overwrite it | |
23 shopt -s histappend | |
24 | |
25 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
26 # export HISTSIZE=3000 [readonly on Cirrus :-[ | |
27 export HISTFILESIZE=6000 | |
28 export HISTIGNORE='[ ]*:&:[fb]g:exit' | |
29 fi | |
30 | |
31 module load gcc # assumed by Prefix | |
32 module load gnu-parallel | |
33 | |
34 export PYTHONPATH=$HOME/lib/python3.6/site-packages | |
35 | |
36 PATH="/lustre/home/dc007/hst/lib/perl5/bin${PATH:+:${PATH}}"; export PATH; | |
37 PERL5LIB="/lustre/home/dc007/hst/lib/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; | |
38 PERL_LOCAL_LIB_ROOT="/lustre/home/dc007/hst/lib/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; | |
39 PERL_MB_OPT="--install_base \"/lustre/home/dc007/hst/lib/perl5\""; export PERL_MB_OPT; | |
40 PERL_MM_OPT="INSTALL_BASE=/lustre/home/dc007/hst/lib/perl5"; export PERL_MM_OPT; | |
41 | |
42 export ANT_HOME=$HOME/src/apache-ant-1.10.7 | |
43 export MAVEN_HOME=$HOME/src/apache-maven-3.6.3 | |
44 export JAVA_HOME=$HOME/lib/openjdk-8u252-b09 | |
45 export PATH=${PATH}:${ANT_HOME}/bin:${MAVEN_HOME}/bin | |
46 | |
47 EDITOR=emacs | |
48 else | |
49 # gentoo | |
50 if [ "$PS1" ]; then | |
51 echo "~/.bashrc inside gentoo" 1>&2 | |
52 PS1='\[\e[1;32m\]\h\[\e[0m\]<\!>: ' | |
53 # Source some global definitions? | |
54 | |
55 # These are readonly under Cirrus, so repeated here where they work1 | |
56 export HISTCONTROL=ignoreboth | |
57 export HISTSIZE=3000 | |
58 export HISTFILESIZE=6000 | |
59 shopt -s histappend | |
60 | |
61 if [ "$DISPLAY" ] | |
62 then | |
63 xrdb $HOME/.Xresources | |
64 fi | |
65 fi | |
66 EDITOR=xemacs | |
67 fi | 11 fi |
68 | 12 |
69 # User specific aliases and functions | 13 . ~/.bash_extras |
70 #module add gnu-parallel | |
71 #export N1=rli4n35 | |
72 #export N2=rli6n35 | |
73 #export NN="$N1 $N2" | |
74 | 14 |
75 # Tools | 15 savehist () |
76 function lss() { | 16 { |
77 /bin/ls -l "$@" | sort -nr -k 5,5 | 17 hc=$(history 1 | tr -d '\n' | cut -d ' ' -f 2); |
78 } | 18 if [ $((hc % ${HIST_FREQ-10})) = 0 ]; then |
79 | 19 history -a; |
80 function sus() { | 20 fi |
81 sort "$@" | uniq -c | sort -k1nr,1 | |
82 } | 21 } |
83 | 22 |
84 function tot () | 23 prompt () |
85 { | 24 { |
86 awk '{sum+=$1} END {printf "%u\n",sum}' | 25 savehist |
26 echo -ne '\033]0;'${HOSTNAME/-login/} ${PWD/$HOME/\~}'\007' | |
87 } | 27 } |
88 | 28 |
89 btot () | 29 if [ "$PS1" ]; then |
90 { | 30 PS1='\[\033[1m\]\h\[\033[0m\]<\!>: ' |
91 python3 -c 'import sys | 31 # LD_LIBRARY_PATH=/home/dc007/dc007/hst/lib64 gdb >/dev/null 2>&1 <<EOF |
92 commas = False | 32 # attach $$ |
93 if len(sys.argv)>1: | 33 # call (int) unbind_variable("tt") |
94 if sys.argv[1]=="-c": | 34 # detach |
95 commas = True | 35 # quit |
96 n=0 | 36 # EOF |
97 for l in sys.stdin: | 37 USER_PROMPT_COMMAND=prompt |
98 try: | 38 echo "Vanilla bashrc" 1>&2 |
99 n+=int(l) | 39 # don't put duplicate lines or lines starting with space in the history. |
100 except ValueError as e: | 40 # See bash(1) for more options |
101 print(e,file=sys.stderr) | 41 # export HISTCONTROL=ignoreboth |
102 if commas: | |
103 print(f"{n:,}") | |
104 else: | |
105 print(n) | |
106 ' "$@" | |
107 } | |
108 | 42 |
109 function uz () { $G/usr/bin/igzip -dc "$@" ; } | 43 # append to the history file, don't overwrite it |
44 shopt -s histappend | |
110 | 45 |
111 function typecat () | 46 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) |
112 { | 47 # export HISTSIZE=3000 |
113 tt=$(type $1) | 48 export HISTFILESIZE=6000 |
114 case $tt in | 49 export HISTIGNORE='[ ]*:&:[fb]g:exit' |
115 *\ is\ hashed\ *) cat $(echo $tt | cut -f 4 -d ' ' | tr -d '()') ;; | 50 fi |
116 *\ is\ /*) cat $(echo $tt | cut -f 3 -d ' ' | tr -d '()') ;; | |
117 *) type $1 ;; | |
118 esac | |
119 } | |
120 #export HISTSIZE=3000 | |
121 | 51 |
122 PATH=$PATH:$HOME/.local/bin:$HOME/bin | 52 EDITOR=emacs |
123 | 53 |
124 export PATH EDITOR PS1 G | 54 WSHARED=/work/dc007/dc007/shared |
55 | |
56 PATH=$PATH:$HOME/.local/bin:$HOME/bin:$WSHARED/bin | |
57 | |
58 export PATH EDITOR PS1 WSHARED USER_PROMPT_COMMAND |