]>
Commit | Line | Data |
---|---|---|
8868edaf CR |
1 | # This program is free software: you can redistribute it and/or modify |
2 | # it under the terms of the GNU General Public License as published by | |
3 | # the Free Software Foundation, either version 3 of the License, or | |
4 | # (at your option) any later version. | |
5 | # | |
6 | # This program is distributed in the hope that it will be useful, | |
7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | # GNU General Public License for more details. | |
10 | # | |
11 | # You should have received a copy of the GNU General Public License | |
12 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
13 | # | |
d233b485 | 14 | trap 'rm $TMPDIR/newhistory' 0 |
d166f048 | 15 | |
cce855bc JA |
16 | # bad options |
17 | history -x | |
18 | # cannot use -r and -w at the same time | |
19 | history -r -w /dev/null | |
20 | ||
21 | # bad option | |
22 | fc -v | |
23 | ||
95732b49 JA |
24 | unset HISTFILESIZE |
25 | ||
cce855bc JA |
26 | # all of these should result in an empty history list |
27 | history -c | |
28 | history -r /dev/null | |
29 | history -n /dev/null | |
d166f048 JA |
30 | history -c |
31 | ||
32 | HISTFILE=history.list | |
33 | HISTCONTROL=ignoreboth | |
34 | HISTIGNORE='&:history*:fc*' | |
35 | HISTSIZE=32 | |
d233b485 | 36 | export HISTIGNORE |
d166f048 JA |
37 | |
38 | shopt -s cmdhist | |
39 | set -o history | |
40 | ||
41 | history | |
42 | ||
43 | fc -l | |
44 | fc -nl | |
45 | ||
46 | fc -lr | |
47 | fc -nlr | |
48 | ||
49 | history -s "echo line for history" | |
50 | history | |
51 | ||
52 | history -p '!!' | |
53 | ||
54 | fc -nl | |
55 | ||
d233b485 | 56 | HISTFILE=$TMPDIR/newhistory |
d166f048 JA |
57 | history -a |
58 | echo displaying \$HISTFILE after history -a | |
59 | cat $HISTFILE | |
60 | ||
61 | history | |
62 | history -w | |
63 | cat $HISTFILE | |
64 | ||
65 | history -s "echo line 2 for history" | |
66 | history | |
67 | history -p '!e' | |
68 | history -p '!!' | |
69 | ||
70 | # this should show up as one history entry | |
71 | for x in one two three | |
72 | do | |
73 | : | |
74 | done | |
75 | history | |
76 | ||
77 | # just a basic test. a full test suite for history expansion should be | |
78 | # created | |
79 | set -H | |
80 | !! | |
81 | !e | |
82 | ||
83 | unset HISTSIZE | |
84 | unset HISTFILE | |
85 | ||
86 | fc -l 4 | |
87 | fc -l 4 8 | |
88 | ||
8868edaf | 89 | # now an out-of-range error because of the one=two not found in history |
cce855bc | 90 | fc -l one=two three=four 502 |
d166f048 JA |
91 | |
92 | history 4 | |
93 | ||
94 | shopt -so history | |
95 | shopt -s expand_aliases | |
96 | ||
97 | alias r="fc -s" | |
98 | ||
99 | echo aa ab ac | |
100 | ||
101 | r a=x | |
cce855bc | 102 | r x=4 b=8 |
d166f048 JA |
103 | |
104 | # this had better fail with `no command found' | |
105 | r cc | |
106 | ||
107 | unalias -a | |
108 | alias | |
109 | ||
3185942a JA |
110 | # these two blocks had better both result in the same output |
111 | echo aa | |
112 | echo bb | |
113 | echo cc | |
114 | fc -e cat | |
115 | ||
116 | echo aa | |
117 | echo bb | |
118 | echo cc | |
119 | fc -e cat -1 | |
120 | ||
d166f048 JA |
121 | set +o history |
122 | ||
123 | shopt -q -o history | |
124 | echo $? | |
3185942a JA |
125 | |
126 | ${THIS_SH} ./history1.sub | |
a0c0a00f | 127 | rm -f $TMPDIR/foohist-* |
0001803f CR |
128 | |
129 | ${THIS_SH} ./history2.sub | |
d233b485 | 130 | ${THIS_SH} ./history3.sub |
8868edaf CR |
131 | ${THIS_SH} ./history4.sub |
132 | ${THIS_SH} ./history5.sub |