~ubuntu-branches/ubuntu/trusty/bash/trusty-security

« back to all changes in this revision

Viewing changes to tests/history.tests

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-03-03 22:52:05 UTC
  • mfrom: (1.3.5) (2.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20140303225205-87ltrt5kspeq0g1b
Tags: 4.3-1ubuntu1
* Merge with Debian; remaining changes:
  - skel.bashrc:
    - Run lesspipe.
    - Enable ls aliases.
    - Set options in ll alias to -alF.
    - Define an alert alias.
    - Enabled colored grep aliases.
  - etc.bash.bashrc:
    - Add sudo hint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
# 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
 
 
106
set +o history
 
107
 
 
108
shopt -q -o history
 
109
echo $?
 
110
 
 
111
${THIS_SH} ./history1.sub
 
112
rm foohist-*
 
113
 
 
114
${THIS_SH} ./history2.sub