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