]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/history4.sub
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / history4.sub
1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
5 #
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
10 #
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 #
14 HISTFILE=$TMPDIR/newhistory-$$
15 export HISTFILE
16
17 trap 'rm -f $HISTFILE' EXIT
18
19 HISTSIZE=32
20 HISTFILESIZE=32
21 echo
22 set -o history
23 history -c
24 echo 0
25 echo 1
26 echo 2
27 echo "(left
28 mid
29 right)"
30 echo A
31 echo B
32 history -w
33 set +o history
34
35 echo
36 printf $'HISTFILE=\n\cRleft\cO\cO\cO\cO\n' | HISTSIZE= ${THIS_SH} --norc -i 2>/dev/null
37 echo
38 printf $'HISTFILE=\n\cRleft\cO\cO\cO\cO\n' | HISTSIZE=8 ${THIS_SH} --norc -i 2>/dev/null
39
40 input="$(cat $HISTFILE)
41 "$'\cP\cP\cP\cO\cO
42 '
43
44 echo
45 printf "$input" | HISTSIZE= HISTFILE= ${THIS_SH} --norc -i 2>/dev/null
46 echo
47 printf "$input" | HISTSIZE=6 HISTFILE= ${THIS_SH} --norc -i 2>/dev/null