mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-10 13:40:55 +02:00
history builtin has a -H option to display history entries as they would be written to the history file; history builtin now takes a START-END range specifier for listing; fix stray semicolon when printing shell functions containing a case command; changes to stdin redirection detection in preparation for POSIX interp 1913
This commit is contained in:
@@ -363,7 +363,7 @@ Use `man -k' or `info' to find out more about commands not in this list.
|
||||
|
||||
A star (*) next to a name means that the command is disabled.
|
||||
|
||||
! PIPELINE history [-c] [-d offset] [n] or hist>
|
||||
! PIPELINE history [-c] [-H] [-d range] [range]>
|
||||
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
|
||||
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
|
||||
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
|
||||
@@ -456,7 +456,7 @@ Use `man -k' or `info' to find out more about commands not in this list.
|
||||
|
||||
A star (*) next to a name means that the command is disabled.
|
||||
|
||||
! PIPELINE history [-c] [-d offset] [n] or hist>
|
||||
! PIPELINE history [-c] [-H] [-d range] [range]>
|
||||
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
|
||||
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
|
||||
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
|
||||
|
||||
+118
-1
@@ -1,5 +1,5 @@
|
||||
./history.tests: line 19: history: -x: invalid option
|
||||
history: usage: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
|
||||
history: usage: history [-c] [-H] [-d range] [range] or history -anrw [filename] or history -ps arg [arg...]
|
||||
./history.tests: line 21: history: cannot use more than one of -anrw
|
||||
./history.tests: line 24: fc: -v: invalid option
|
||||
fc: usage: fc [-e ename] [-D] [-lnr] [first] [last] or fc -s [pat=rep] [command]
|
||||
@@ -439,3 +439,120 @@ edit append
|
||||
8 echo three append
|
||||
9 # simulate readline edit_and_execute_command
|
||||
10 echo edit append
|
||||
history11.sub
|
||||
one
|
||||
two
|
||||
three
|
||||
four
|
||||
five
|
||||
six
|
||||
seven
|
||||
eight
|
||||
nine
|
||||
ten
|
||||
1 echo one
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
5 echo five
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
|
||||
1 echo one
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
5 echo five
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
1 echo one
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
5 echo five
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
11 echo a
|
||||
12 echo b
|
||||
13 echo c
|
||||
14 echo d
|
||||
15 echo e
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
11 echo a
|
||||
12 echo b
|
||||
13 echo c
|
||||
14 echo d
|
||||
15 echo e
|
||||
|
||||
15 echo e
|
||||
|
||||
./history11.sub: line 49: history: 18: history position out of range
|
||||
./history11.sub: line 50: history: 18: history position out of range
|
||||
|
||||
1 echo one
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
5 echo five
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
11 echo a
|
||||
12 echo b
|
||||
13 echo c
|
||||
14 echo d
|
||||
15 echo e
|
||||
|
||||
./history11.sub: line 54: history: 22: history position out of range
|
||||
./history11.sub: line 55: history: 22: history position out of range
|
||||
|
||||
./history11.sub: line 57: history: 16: history position out of range
|
||||
./history11.sub: line 58: history: 200: history position out of range
|
||||
./history11.sub: line 59: history: -20: history position out of range
|
||||
./history11.sub: line 60: history: -50: history position out of range
|
||||
./history11.sub: line 61: history: 5-0xaf: history position out of range
|
||||
./history11.sub: line 63: history: @42: numeric argument required
|
||||
./history11.sub: line 64: history: -0xaf: numeric argument required
|
||||
./history11.sub: line 68: history: -200: history position out of range
|
||||
|
||||
1 echo one
|
||||
2 echo two
|
||||
3 echo three
|
||||
4 echo four
|
||||
5 echo five
|
||||
6 echo six
|
||||
7 echo seven
|
||||
8 echo eight
|
||||
9 echo nine
|
||||
10 echo ten
|
||||
11 echo a
|
||||
12 echo b
|
||||
13 echo c
|
||||
14 echo d
|
||||
|
||||
./history11.sub: line 71: history: 20: history position out of range
|
||||
./history11.sub: line 72: history: -30: history position out of range
|
||||
|
||||
@@ -138,3 +138,4 @@ test_runsub ./history7.sub
|
||||
test_runsub ./history8.sub
|
||||
test_runsub ./history9.sub
|
||||
test_runsub ./history10.sub
|
||||
test_runsub ./history11.sub
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
set -o history
|
||||
HISTFILE=$TMPDIR/history-$$
|
||||
|
||||
history -c
|
||||
|
||||
echo one
|
||||
echo two
|
||||
echo three
|
||||
echo four
|
||||
echo five
|
||||
echo six
|
||||
echo seven
|
||||
echo eight
|
||||
echo nine
|
||||
echo ten
|
||||
|
||||
history ; echo
|
||||
|
||||
history 2-4 ; echo
|
||||
|
||||
history
|
||||
|
||||
echo a
|
||||
echo b
|
||||
echo c
|
||||
echo d
|
||||
echo e
|
||||
|
||||
history
|
||||
|
||||
history 6--1; echo
|
||||
history -- -1 ; echo
|
||||
|
||||
history 18-14
|
||||
history 14-18 ; echo
|
||||
|
||||
history ; echo
|
||||
|
||||
history -- -1-22
|
||||
history -- 22--2 ; echo
|
||||
|
||||
history 16-40
|
||||
history 1-200
|
||||
history -- -20-50
|
||||
history 1--50
|
||||
history 5-0xaf
|
||||
|
||||
history @42
|
||||
history -- -0xaf
|
||||
|
||||
# out of range arguments are clamped at 0 and history_length, respectively
|
||||
history -d -2--1 # remove comment and this command
|
||||
history -- -200--1 ; echo
|
||||
history 567 ; echo
|
||||
|
||||
history -- -1-20
|
||||
history -- 1--30
|
||||
|
||||
unset HISTFILE
|
||||
exit 0
|
||||
Reference in New Issue
Block a user