2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
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
13 # History related options first and always, or else we risk screwing up
14 # the history file. This is duplicated in ~/.bash_profile just for good
17 # History file size limit, set to unlimited.
18 # this needs to be different from the default because
19 # default HISTFILESIZE is 500 and could clobber our history
21 # max commands 1 session can append/read from history
23 # the time format display when doing the history command
24 # also, setting this makes the history file record time
25 # of each command as seconds from the epoch
26 HISTTIMEFORMAT
="%Y-%m-%d %I:%M %p "
27 # consecutive duplicate lines dont go in history
28 HISTCONTROL
=ignoredups
29 # This works in addition to HISTCONTROL to do more flexible things
30 # it could also do the same things as HISTCONTROL and thus replace it,
31 # but meh. dunno why, but just " *" does glob expansion, so use [ ] to avoid it.
32 HISTIGNORE
='pass *:otp *:oathtool *:histrm *'
36 #### begin section that works with sl() function to return from
37 # noninteractive ssh shells, or tty. tty because often i
38 # use it when something is going and io is slow and my bashrc
40 if [[ $LC_USEBASHRC != t
&& ( $SSH_CONNECTION ||
$TERM == linux
) ]]; then
41 # Here we did not opt-in to running our .bashrc file so we just
42 # return, but we still setup a function to source it without returning
43 # so if we want it we don't have to restart our ssh connection.
51 ###### Begin sourcing of files #####
53 # The distinction between login and non-login shells is super lame
54 # and pretty random. get rid of that distinction.
55 if ! shopt -q login_shell
; then
56 if [[ -r /etc
/profile
]]; then
59 # note, this is not exactly the same as a login shell, because that
60 # reads ~/.bash_profile or alternative, which usually just sources
61 # this file, and we don't want to do that and cause an infinite
65 # source brc and brc2 if they exist. We have to readlink because we
66 # could be using sl() from ./brc.
67 _tmp
=$
(readlink
-f ${BASH_SOURCE[0]})
70 if [[ -s $bashrc_dir ]]; then
71 # shellcheck source=./brc
74 # brc2 is for things i dont necessarily want on every system
76 if [[ -s $_tmp ]]; then
77 # shellcheck source=./brc2
80 # This check is for when running the sl() command,
81 # and the remote host got its type misidentified.
82 _tmp
=$bashrc_dir/..
/brc2
83 if [[ -s $_tmp ]]; then
84 # shellcheck source=./brc2
88 ###### End sourcing of files #####
90 #### end section that works with sl() function to return from
91 #### noninteractive ssh shells
94 # ensure no bad programs appending to this file will have an affect
97 # kitty puts this here on startup, i need to build with some option to
100 # BEGIN_KITTY_SHELL_INTEGRATION
101 if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi
102 # END_KITTY_SHELL_INTEGRATION