4a218c301b7a4837e0de3951fcfe9847f9ee127e
[platform/upstream/bash.git] / tests / history.tests
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 # all of these should result in an empty history list
12 history -c
13 history -r /dev/null
14 history -n /dev/null
15 history -c
16
17 HISTFILE=history.list
18 HISTCONTROL=ignoreboth
19 HISTIGNORE='&:history*:fc*'
20 HISTSIZE=32
21
22 shopt -s cmdhist
23 set -o history
24
25 history
26
27 fc -l
28 fc -nl
29
30 fc -lr
31 fc -nlr
32
33 history -s "echo line for history"
34 history
35
36 history -p '!!'
37
38 fc -nl
39
40 HISTFILE=/tmp/newhistory
41 history -a
42 echo displaying \$HISTFILE after history -a
43 cat $HISTFILE
44
45 history
46 history -w
47 cat $HISTFILE
48
49 history -s "echo line 2 for history"
50 history
51 history -p '!e'
52 history -p '!!'
53
54 # this should show up as one history entry
55 for x in one two three
56 do
57         :
58 done
59 history
60
61 # just a basic test.  a full test suite for history expansion should be
62 # created
63 set -H
64 !!
65 !e
66
67 unset HISTSIZE
68 unset HISTFILE
69
70 fc -l 4
71 fc -l 4 8
72
73 fc -l 502
74 fc -l one=two three=four 502
75
76 history 4
77
78 shopt -so history
79 shopt -s expand_aliases
80
81 alias r="fc -s"
82
83 echo aa ab ac
84
85 r a=x
86 r x=4 b=8
87
88 # this had better fail with `no command found'
89 r cc
90
91 unalias -a
92 alias
93
94 set +o history
95
96 shopt -q -o history
97 echo $?