-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory
64 lines (57 loc) · 2.03 KB
/
history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
# set up history variables and load in shell history
#
##############################################################################
esetenv LOGBASE $HOME/var/log
# we log these values in prompt_command(), should be sufficient
# one-time on shell init (don't see them changing)
#
esetenv TTY_TYPE ${TERMINAL/\//} # for `pts/X' strip off the `/'
esetenv TTY_TYPE ${TERMINAL:0:3} # `pts' or `tty'
esetenv TTY_NUM ${TERMINAL:3} # the raw number of the tty
esetenv TTY_NUM ${TTY_NUM#/} # strip leading `/' if exists (for pts)
esetenv LOGFILE_BASH $LOGBASE/history.$HOSTNAME
esetenv LOGFILE_CMDS $LOGBASE/cmdhist.$HOSTNAME
# this needs to be set before history -r is done, it describes
# the time format it was written in for the shell history parser
#
esetenv HISTTIMEFORMAT '%Y%m%d%H%M%S '
# these aren't used anymore because we bypass the shell's own
# logging system (everything is logged via $PROMPT_COMMAND)
# but we still need to set the size to unlimited (empty string)
# and this value is also inherited by HISTFILESIZE (but we want
# to export it, so we do it explicitly here); in both cases
# empty string means unlimited (docs say use negative values,
# but empty string works on older shells)
#
esetenv HISTSIZE ""
esetenv HISTFILESIZE "$HISTSIZE"
#esetenv HISTCONTROL "ignorespace"
esetenv HISTCONTROL ""
esetenv HISTIGNORE "f:f *:" \
"m:m *:" \
"fg:fg *:" \
"gf:gf *:" \
"fm:mf:" \
"j:" \
"hist*:" \
"rml:rml2:" \
"1:2:3:4:5:6:7:8:9:10:" \
"11:12:13:14:15:16:17:18:19:20:" \
"21:22:23:24:25:26:27:28:29:30"
# these are still used by the shell to determine where to append
# (-o histappend) or to overwrite (+o histappend) when it exits;
# it then dumps the history contents here. We are doing it
# ourselves right now in $PROMPT_COMMAND so we turn it off
# completely
#
#export HISTFILE=~/.bash_history
#export HISTFILE=/dev/null
unset HISTFILE
shell_init_history ()
{
local savedfmt="$HISTTIMEFORMAT"
HISTTIMEFORMAT=%s
history -cr $LOGFILE_BASH
HISTTIMEFORMAT="$savedfmt"
}