]>
Commit | Line | Data |
---|---|---|
d166f048 JA |
1 | trap 'rm /tmp/newhistory' 0 |
2 | ||
cce855bc JA |
3 | # bad options |
4 | history -x | |
5 | # cannot use -r and -w at the same time | |
6 | history -r -w /dev/null | |
7 | ||
8 | # bad option | |
9 | fc -v | |
10 | ||
95732b49 JA |
11 | unset HISTFILESIZE |
12 | ||
cce855bc JA |
13 | # all of these should result in an empty history list |
14 | history -c | |
15 | history -r /dev/null | |
16 | history -n /dev/null | |
d166f048 JA |
17 | history -c |
18 | ||
19 | HISTFILE=history.list | |
20 | HISTCONTROL=ignoreboth | |
21 | HISTIGNORE='&:history*:fc*' | |
22 | HISTSIZE=32 | |
23 | ||
24 | shopt -s cmdhist | |
25 | set -o history | |
26 | ||
27 | history | |
28 | ||
29 | fc -l | |
30 | fc -nl | |
31 | ||
32 | fc -lr | |
33 | fc -nlr | |
34 | ||
35 | history -s "echo line for history" | |
36 | history | |
37 | ||
38 | history -p '!!' | |
39 | ||
40 | fc -nl | |
41 | ||
42 | HISTFILE=/tmp/newhistory | |
43 | history -a | |
44 | echo displaying \$HISTFILE after history -a | |
45 | cat $HISTFILE | |
46 | ||
47 | history | |
48 | history -w | |
49 | cat $HISTFILE | |
50 | ||
51 | history -s "echo line 2 for history" | |
52 | history | |
53 | history -p '!e' | |
54 | history -p '!!' | |
55 | ||
56 | # this should show up as one history entry | |
57 | for x in one two three | |
58 | do | |
59 | : | |
60 | done | |
61 | history | |
62 | ||
63 | # just a basic test. a full test suite for history expansion should be | |
64 | # created | |
65 | set -H | |
66 | !! | |
67 | !e | |
68 | ||
69 | unset HISTSIZE | |
70 | unset HISTFILE | |
71 | ||
72 | fc -l 4 | |
73 | fc -l 4 8 | |
74 | ||
cce855bc | 75 | fc -l one=two three=four 502 |
d166f048 JA |
76 | |
77 | history 4 | |
78 | ||
79 | shopt -so history | |
80 | shopt -s expand_aliases | |
81 | ||
82 | alias r="fc -s" | |
83 | ||
84 | echo aa ab ac | |
85 | ||
86 | r a=x | |
cce855bc | 87 | r x=4 b=8 |
d166f048 JA |
88 | |
89 | # this had better fail with `no command found' | |
90 | r cc | |
91 | ||
92 | unalias -a | |
93 | alias | |
94 | ||
3185942a JA |
95 | # these two blocks had better both result in the same output |
96 | echo aa | |
97 | echo bb | |
98 | echo cc | |
99 | fc -e cat | |
100 | ||
101 | echo aa | |
102 | echo bb | |
103 | echo cc | |
104 | fc -e cat -1 | |
105 | ||
d166f048 JA |
106 | set +o history |
107 | ||
108 | shopt -q -o history | |
109 | echo $? | |
3185942a JA |
110 | |
111 | ${THIS_SH} ./history1.sub | |
a0c0a00f | 112 | rm -f $TMPDIR/foohist-* |
0001803f CR |
113 | |
114 | ${THIS_SH} ./history2.sub |