Line | |
---|
1 | trap 'rm /tmp/newhistory' 0
|
---|
2 |
|
---|
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 |
|
---|
11 | unset HISTFILESIZE
|
---|
12 |
|
---|
13 | # all of these should result in an empty history list
|
---|
14 | history -c
|
---|
15 | history -r /dev/null
|
---|
16 | history -n /dev/null
|
---|
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 |
|
---|
75 | fc -l one=two three=four 502
|
---|
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
|
---|
87 | r x=4 b=8
|
---|
88 |
|
---|
89 | # this had better fail with `no command found'
|
---|
90 | r cc
|
---|
91 |
|
---|
92 | unalias -a
|
---|
93 | alias
|
---|
94 |
|
---|
95 | set +o history
|
---|
96 |
|
---|
97 | shopt -q -o history
|
---|
98 | echo $?
|
---|
Note:
See
TracBrowser
for help on using the repository browser.