fix jrun
[distro-setup] / .bashrc
1 #!/bin/bash
2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
4
5 # to debug
6 #set -x
7 # redirect output to log file. this doesn't work. todo figure out why
8 #exec 1>>/a/tmp/bashlog
9 #exec 2>>/a/tmp/bashlog
10
11
12
13 # History related options first, or else
14 # we risk screwing up history history. And this is duplicated
15 # in ~/.bash_profile just for good measure
16 # history number. History expansion is good.
17 PS4='$LINENO+ '
18 # history file size limit, set to unlimited.
19 # this needs to be different from the default because
20 # default HISTFILESIZE is 500 and could clobber our history
21 HISTFILESIZE=
22 # max commands 1 session can append/read from history
23 HISTSIZE=1000000
24 # the time format display when doing the history command
25 # also, setting this makes the history file record time
26 # of each command as seconds from the epoch
27 HISTTIMEFORMAT="%Y-%m-%d %I:%M %p "
28 # consecutive duplicate lines dont go in history
29 HISTCONTROL=ignoredups
30 # works in addition to HISTCONTROL to do more flexible things
31 # it could also do the same things as HISTCONTROL and thus replace it,
32 # but meh. dunno why, but just " *" does glob expansion, so use [ ] to avoid it.
33 HISTIGNORE='pass *:[ ]*:otp *:oathtool *'
34
35
36 # see comments in brc2 sl() function for background.
37 if [[ $SSH_CONNECTION ]] \
38 && [[ $BRC != t ]]; then
39 return 0
40 else
41
42 # the distinction between login and non-login shells is lame,
43 # get rid of it. note ssh shells normally its login if a command is passed
44 if ! shopt -q login_shell; then
45 if [[ -r /etc/profile ]]; then
46 source /etc/profile
47 fi
48 # note, this is not exactly the same as a login shell, because that
49 # reads ~/.bash_profile or alternative, which usually just sources
50 # this file, and we don't want to do that and cause an infinite
51 # loop.
52 fi
53 _tmp=$(readlink -f ${BASH_SOURCE[0]})
54 _tmp=${_tmp%/*}
55 _tmp2=$_tmp/brc
56 if [[ -s $_tmp2 ]]; then
57 # shellcheck source=./brc
58 source $_tmp2
59 fi
60 # brc2 is for things i dont necessarily want on every system
61 _tmp2=$_tmp/brc2
62 if [[ -s $_tmp2 ]]; then
63 # shellcheck source=./brc2
64 source $_tmp2
65 else
66 # This check is for when running the sl() command,
67 # and the remote host got its type misidentified.
68 _tmp2=$_tmp/../brc2
69 if [[ -s $_tmp2 ]]; then
70 # shellcheck source=./brc2
71 source $_tmp2
72 fi
73 fi
74 fi
75
76
77 # ensure no bad programs appending to this file will have an affect
78 return 0