Imported from ../bash-2.05b.tar.gz.
[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 one=two three=four 502
74
75 history 4
76
77 shopt -so history
78 shopt -s expand_aliases
79
80 alias r="fc -s"
81
82 echo aa ab ac
83
84 r a=x
85 r x=4 b=8
86
87 # this had better fail with `no command found'
88 r cc
89
90 unalias -a
91 alias
92
93 set +o history
94
95 shopt -q -o history
96 echo $?