blob: 53321f051d161e4cf65a25203724546c504f7ed7 (
plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
trap 'rm $TMPDIR/newhistory' 0
# bad options
history -x
# cannot use -r and -w at the same time
history -r -w /dev/null
# bad option
fc -v
unset HISTFILESIZE
# all of these should result in an empty history list
history -c
history -r /dev/null
history -n /dev/null
history -c
HISTFILE=history.list
HISTCONTROL=ignoreboth
HISTIGNORE='&:history*:fc*'
HISTSIZE=32
export HISTIGNORE
shopt -s cmdhist
set -o history
history
fc -l
fc -nl
fc -lr
fc -nlr
history -s "echo line for history"
history
history -p '!!'
fc -nl
HISTFILE=$TMPDIR/newhistory
history -a
echo displaying \$HISTFILE after history -a
cat $HISTFILE
history
history -w
cat $HISTFILE
history -s "echo line 2 for history"
history
history -p '!e'
history -p '!!'
# this should show up as one history entry
for x in one two three
do
:
done
history
# just a basic test. a full test suite for history expansion should be
# created
set -H
!!
!e
unset HISTSIZE
unset HISTFILE
fc -l 4
fc -l 4 8
# now an out-of-range error because of the one=two not found in history
fc -l one=two three=four 502
history 4
shopt -so history
shopt -s expand_aliases
alias r="fc -s"
echo aa ab ac
r a=x
r x=4 b=8
# this had better fail with `no command found'
r cc
unalias -a
alias
# these two blocks had better both result in the same output
echo aa
echo bb
echo cc
fc -e cat
echo aa
echo bb
echo cc
fc -e cat -1
set +o history
shopt -q -o history
echo $?
${THIS_SH} ./history1.sub
rm -f $TMPDIR/foohist-*
${THIS_SH} ./history2.sub
${THIS_SH} ./history3.sub
${THIS_SH} ./history4.sub
${THIS_SH} ./history5.sub
|