mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-10-14 08:00:26 +02:00
documentation updates for history builtin to note it does not truncate the history file; documentation updates for HISTFILESIZE noting that it can work on lines or history entries depending on $HISTTIMEFORMAT; documentation update for history saving behavior at shell exit; history -w and history -a should update the number of history entries in the current session if they are using $HISTFILE; history -r now updates the number of history entries in the current session; improvement to history_truncate_file so it leaves fewer partial history entries when operating on lines
This commit is contained in:
+165
-147
@@ -1,9 +1,9 @@
|
||||
This is bash.info, produced by makeinfo version 7.3 from bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.4, 20 August 2026).
|
||||
Bash shell (version 5.4, 27 August 2026).
|
||||
|
||||
This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash
|
||||
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
|
||||
Reference Manual’, for ‘Bash’, Version 5.4.
|
||||
|
||||
Copyright © 1988-2026 Free Software Foundation, Inc.
|
||||
@@ -26,10 +26,10 @@ Bash Features
|
||||
*************
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.4, 20 August 2026). The Bash home page is
|
||||
Bash shell (version 5.4, 27 August 2026). The Bash home page is
|
||||
<http://www.gnu.org/software/bash/>.
|
||||
|
||||
This is Edition 5.4, last updated 20 August 2026, of ‘The GNU Bash
|
||||
This is Edition 5.4, last updated 27 August 2026, of ‘The GNU Bash
|
||||
Reference Manual’, for ‘Bash’, Version 5.4.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -5430,7 +5430,7 @@ This builtin allows you to change additional optional shell behavior.
|
||||
‘histappend’
|
||||
If set, the history list is appended to the file named by the
|
||||
value of the ‘HISTFILE’ variable when the shell exits, rather
|
||||
than overwriting the file.
|
||||
than potentially overwriting the file.
|
||||
|
||||
‘histreedit’
|
||||
If set, and Readline is being used, the user is given the
|
||||
@@ -6161,15 +6161,18 @@ Variables::).
|
||||
exits.
|
||||
|
||||
‘HISTFILESIZE’
|
||||
The maximum number of lines contained in the history file. When
|
||||
this variable is assigned a value, the history file is truncated,
|
||||
if necessary, to contain no more than the number of history entries
|
||||
that total no more than that number of lines by removing the oldest
|
||||
entries. If the history list contains multi-line entries, the
|
||||
history file may contain more lines than this maximum to avoid
|
||||
leaving partial history entries. The history file is also
|
||||
truncated to this size after writing it when a shell exits or by
|
||||
the ‘history’ builtin. If the value is 0, the history file is
|
||||
The maximum number of lines or history entries contained in the
|
||||
history file. When this variable is assigned a value, the history
|
||||
file is truncated, if necessary, to contain no more than that
|
||||
number of history entries or lines, depending on the value of
|
||||
‘HISTTIMEFORMAT’, by removing the oldest entries.
|
||||
|
||||
*Note Bash History Facilities::, for a description of how
|
||||
‘HISTTIMEFORMAT’ affects how the value is treated and whether it
|
||||
refers to lines or history entries.
|
||||
|
||||
The history file is also truncated to this size after writing it
|
||||
when a shell exits. If the value is 0, the history file is
|
||||
truncated to zero size. Non-numeric values and numeric values less
|
||||
than zero inhibit truncation. The shell sets the default value to
|
||||
the value of ‘HISTSIZE’ after reading any startup files.
|
||||
@@ -11012,10 +11015,21 @@ the values of the shell variables ‘HISTIGNORE’ and ‘HISTCONTROL’.
|
||||
reading history entries from the file named by the ‘HISTFILE’ variable
|
||||
(default ‘~/.bash_history’). This is referred to as the “history file”.
|
||||
The history file is truncated, if necessary, to contain no more than the
|
||||
number of history entries specified by the value of the ‘HISTFILESIZE’
|
||||
variable. If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric
|
||||
value, or a numeric value less than zero, the history file is not
|
||||
truncated.
|
||||
number of lines or history entries specified by the value of the
|
||||
‘HISTFILESIZE’ variable.
|
||||
|
||||
The value of ‘HISTFILESIZE’ is interpreted as lines or possibly
|
||||
multi-line history entries depending on whether the ‘HISTTIMEFORMAT’
|
||||
variable has a value, since that controls whether or not timestamps are
|
||||
written to the history file. If ‘HISTTIMEFORMAT’ has a value,
|
||||
‘HISTFILESIZE’ is interpreted as a number of history entries, including
|
||||
timestamps. If it does not, ‘HISTFILESIZE’ is interpreted as a number
|
||||
of lines, which may result in incomplete history entries in the history
|
||||
file, or the history file containing more lines than this maximum to
|
||||
avoid leaving partial history entries.
|
||||
|
||||
If ‘HISTFILESIZE’ is unset, or set to null, a non-numeric value, or a
|
||||
numeric value less than zero, the history file is not truncated.
|
||||
|
||||
When the history file is read, lines beginning with the history
|
||||
comment character followed immediately by a digit are interpreted as
|
||||
@@ -11024,14 +11038,18 @@ optionally displayed depending on the value of the ‘HISTTIMEFORMAT’
|
||||
variable (*note Bash Variables::). When present, history timestamps
|
||||
delimit history entries, making multi-line entries possible.
|
||||
|
||||
When a shell with history enabled exits, Bash copies the last
|
||||
When a shell with history enabled exits, Bash copies up to the last
|
||||
‘$HISTSIZE’ entries from the history list to the file named by
|
||||
‘$HISTFILE’. If the ‘histappend’ shell option is set (*note Bash
|
||||
Builtins::), Bash appends the entries to the history file, otherwise it
|
||||
overwrites the history file. If ‘HISTFILE’ is unset or null, or if the
|
||||
history file is unwritable, the history is not saved. After saving the
|
||||
history, Bash truncates the history file to contain no more than
|
||||
‘$HISTFILESIZE’ lines as described above.
|
||||
Builtins::), or if the number of history entries entered during the
|
||||
current shell session is less than ‘$HISTSIZE’, Bash appends the history
|
||||
entries entered during the current session to ‘$HISTFILE’. If
|
||||
‘histappend’ is not set, and the number of entries from the current
|
||||
shell session exceeds ‘$HISTSIZE’, it overwrites the history file with
|
||||
the entries from the current session. If ‘HISTFILE’ is unset or null,
|
||||
or if the history file is unwritable, the history is not saved. After
|
||||
saving the history, Bash truncates the history file to contain no more
|
||||
than ‘$HISTFILESIZE’ entries as described above.
|
||||
|
||||
If the ‘HISTTIMEFORMAT’ variable is set, the shell writes the
|
||||
timestamp information associated with each history entry to the history
|
||||
@@ -13294,51 +13312,51 @@ D.3 Parameter and Variable Index
|
||||
* HISTCONTROL: Bash Variables. (line 445)
|
||||
* HISTFILE: Bash Variables. (line 463)
|
||||
* HISTFILESIZE: Bash Variables. (line 469)
|
||||
* HISTIGNORE: Bash Variables. (line 483)
|
||||
* HISTIGNORE: Bash Variables. (line 486)
|
||||
* history-preserve-point: Readline Init File Syntax.
|
||||
(line 236)
|
||||
* history-size: Readline Init File Syntax.
|
||||
(line 242)
|
||||
* HISTSIZE: Bash Variables. (line 507)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 514)
|
||||
* HISTSIZE: Bash Variables. (line 510)
|
||||
* HISTTIMEFORMAT: Bash Variables. (line 517)
|
||||
* HOME: Bourne Shell Variables.
|
||||
(line 13)
|
||||
* horizontal-scroll-mode: Readline Init File Syntax.
|
||||
(line 252)
|
||||
* HOSTFILE: Bash Variables. (line 523)
|
||||
* HOSTNAME: Bash Variables. (line 534)
|
||||
* HOSTTYPE: Bash Variables. (line 537)
|
||||
* HOSTFILE: Bash Variables. (line 526)
|
||||
* HOSTNAME: Bash Variables. (line 537)
|
||||
* HOSTTYPE: Bash Variables. (line 540)
|
||||
* IFS: Bourne Shell Variables.
|
||||
(line 18)
|
||||
* IGNOREEOF: Bash Variables. (line 540)
|
||||
* IGNOREEOF: Bash Variables. (line 543)
|
||||
* input-meta: Readline Init File Syntax.
|
||||
(line 260)
|
||||
* INPUTRC: Bash Variables. (line 549)
|
||||
* INSIDE_EMACS: Bash Variables. (line 553)
|
||||
* INPUTRC: Bash Variables. (line 552)
|
||||
* INSIDE_EMACS: Bash Variables. (line 556)
|
||||
* isearch-terminators: Readline Init File Syntax.
|
||||
(line 271)
|
||||
* keymap: Readline Init File Syntax.
|
||||
(line 278)
|
||||
* LANG: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LANG <1>: Bash Variables. (line 559)
|
||||
* LC_ALL: Bash Variables. (line 563)
|
||||
* LC_COLLATE: Bash Variables. (line 567)
|
||||
* LC_CTYPE: Bash Variables. (line 574)
|
||||
* LANG <1>: Bash Variables. (line 562)
|
||||
* LC_ALL: Bash Variables. (line 566)
|
||||
* LC_COLLATE: Bash Variables. (line 570)
|
||||
* LC_CTYPE: Bash Variables. (line 577)
|
||||
* LC_MESSAGES: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 579)
|
||||
* LC_NUMERIC: Bash Variables. (line 583)
|
||||
* LC_TIME: Bash Variables. (line 587)
|
||||
* LINENO: Bash Variables. (line 591)
|
||||
* LINES: Bash Variables. (line 598)
|
||||
* MACHTYPE: Bash Variables. (line 604)
|
||||
* LC_MESSAGES <1>: Bash Variables. (line 582)
|
||||
* LC_NUMERIC: Bash Variables. (line 586)
|
||||
* LC_TIME: Bash Variables. (line 590)
|
||||
* LINENO: Bash Variables. (line 594)
|
||||
* LINES: Bash Variables. (line 601)
|
||||
* MACHTYPE: Bash Variables. (line 607)
|
||||
* MAIL: Bourne Shell Variables.
|
||||
(line 24)
|
||||
* MAILCHECK: Bash Variables. (line 608)
|
||||
* MAILCHECK: Bash Variables. (line 611)
|
||||
* MAILPATH: Bourne Shell Variables.
|
||||
(line 29)
|
||||
* MAPFILE: Bash Variables. (line 616)
|
||||
* MAPFILE: Bash Variables. (line 619)
|
||||
* mark-modified-lines: Readline Init File Syntax.
|
||||
(line 308)
|
||||
* mark-symlinked-directories: Readline Init File Syntax.
|
||||
@@ -13349,46 +13367,46 @@ D.3 Parameter and Variable Index
|
||||
(line 325)
|
||||
* meta-flag: Readline Init File Syntax.
|
||||
(line 260)
|
||||
* OLDPWD: Bash Variables. (line 620)
|
||||
* OLDPWD: Bash Variables. (line 623)
|
||||
* OPTARG: Bourne Shell Variables.
|
||||
(line 36)
|
||||
* OPTERR: Bash Variables. (line 623)
|
||||
* OPTERR: Bash Variables. (line 626)
|
||||
* OPTIND: Bourne Shell Variables.
|
||||
(line 40)
|
||||
* OSTYPE: Bash Variables. (line 628)
|
||||
* OSTYPE: Bash Variables. (line 631)
|
||||
* output-meta: Readline Init File Syntax.
|
||||
(line 330)
|
||||
* page-completions: Readline Init File Syntax.
|
||||
(line 339)
|
||||
* PATH: Bourne Shell Variables.
|
||||
(line 44)
|
||||
* PIPESTATUS: Bash Variables. (line 631)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 641)
|
||||
* PPID: Bash Variables. (line 651)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 655)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 661)
|
||||
* PS0: Bash Variables. (line 667)
|
||||
* PIPESTATUS: Bash Variables. (line 634)
|
||||
* POSIXLY_CORRECT: Bash Variables. (line 644)
|
||||
* PPID: Bash Variables. (line 654)
|
||||
* PROMPT_COMMAND: Bash Variables. (line 658)
|
||||
* PROMPT_DIRTRIM: Bash Variables. (line 664)
|
||||
* PS0: Bash Variables. (line 670)
|
||||
* PS1: Bourne Shell Variables.
|
||||
(line 53)
|
||||
* PS2: Bourne Shell Variables.
|
||||
(line 58)
|
||||
* PS3: Bash Variables. (line 672)
|
||||
* PS4: Bash Variables. (line 677)
|
||||
* PWD: Bash Variables. (line 685)
|
||||
* RANDOM: Bash Variables. (line 688)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 696)
|
||||
* READLINE_LINE: Bash Variables. (line 700)
|
||||
* READLINE_MARK: Bash Variables. (line 704)
|
||||
* READLINE_POINT: Bash Variables. (line 710)
|
||||
* REPLY: Bash Variables. (line 714)
|
||||
* PS3: Bash Variables. (line 675)
|
||||
* PS4: Bash Variables. (line 680)
|
||||
* PWD: Bash Variables. (line 688)
|
||||
* RANDOM: Bash Variables. (line 691)
|
||||
* READLINE_ARGUMENT: Bash Variables. (line 699)
|
||||
* READLINE_LINE: Bash Variables. (line 703)
|
||||
* READLINE_MARK: Bash Variables. (line 707)
|
||||
* READLINE_POINT: Bash Variables. (line 713)
|
||||
* REPLY: Bash Variables. (line 717)
|
||||
* revert-all-at-newline: Readline Init File Syntax.
|
||||
(line 352)
|
||||
* search-ignore-case: Readline Init File Syntax.
|
||||
(line 359)
|
||||
* SECONDS: Bash Variables. (line 718)
|
||||
* SHELL: Bash Variables. (line 728)
|
||||
* SHELLOPTS: Bash Variables. (line 733)
|
||||
* SHLVL: Bash Variables. (line 743)
|
||||
* SECONDS: Bash Variables. (line 721)
|
||||
* SHELL: Bash Variables. (line 731)
|
||||
* SHELLOPTS: Bash Variables. (line 736)
|
||||
* SHLVL: Bash Variables. (line 746)
|
||||
* show-all-if-ambiguous: Readline Init File Syntax.
|
||||
(line 364)
|
||||
* show-all-if-unmodified: Readline Init File Syntax.
|
||||
@@ -13397,15 +13415,15 @@ D.3 Parameter and Variable Index
|
||||
(line 379)
|
||||
* skip-completed-text: Readline Init File Syntax.
|
||||
(line 385)
|
||||
* SRANDOM: Bash Variables. (line 748)
|
||||
* SRANDOM: Bash Variables. (line 751)
|
||||
* TEXTDOMAIN: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TEXTDOMAINDIR: Creating Internationalized Scripts.
|
||||
(line 51)
|
||||
* TIMEFORMAT: Bash Variables. (line 757)
|
||||
* TMOUT: Bash Variables. (line 796)
|
||||
* TMPDIR: Bash Variables. (line 808)
|
||||
* UID: Bash Variables. (line 812)
|
||||
* TIMEFORMAT: Bash Variables. (line 760)
|
||||
* TMOUT: Bash Variables. (line 799)
|
||||
* TMPDIR: Bash Variables. (line 811)
|
||||
* UID: Bash Variables. (line 815)
|
||||
* vi-cmd-mode-string: Readline Init File Syntax.
|
||||
(line 398)
|
||||
* vi-ins-mode-string: Readline Init File Syntax.
|
||||
@@ -13862,81 +13880,81 @@ Node: Bash Builtins182353
|
||||
Node: Modifying Shell Behavior220088
|
||||
Node: The Set Builtin220430
|
||||
Node: The Shopt Builtin232556
|
||||
Node: Special Builtins250092
|
||||
Node: Shell Variables251081
|
||||
Node: Bourne Shell Variables251515
|
||||
Node: Bash Variables254023
|
||||
Node: Bash Features293307
|
||||
Node: Invoking Bash294321
|
||||
Node: Bash Startup Files301551
|
||||
Node: Interactive Shells306911
|
||||
Node: What is an Interactive Shell?307319
|
||||
Node: Is this Shell Interactive?307981
|
||||
Node: Interactive Shell Behavior308805
|
||||
Node: Bash Conditional Expressions312566
|
||||
Node: Shell Arithmetic317983
|
||||
Node: Aliases321310
|
||||
Node: Arrays324444
|
||||
Node: The Directory Stack332547
|
||||
Node: Directory Stack Builtins333344
|
||||
Node: Controlling the Prompt337789
|
||||
Node: The Restricted Shell340908
|
||||
Node: Bash POSIX Mode344001
|
||||
Node: Shell Compatibility Mode363960
|
||||
Node: Job Control372967
|
||||
Node: Job Control Basics373424
|
||||
Node: Job Control Builtins379792
|
||||
Node: Job Control Variables386580
|
||||
Node: Command Line Editing387811
|
||||
Node: Introduction and Notation389514
|
||||
Node: Readline Interaction391866
|
||||
Node: Readline Bare Essentials393054
|
||||
Node: Readline Movement Commands394862
|
||||
Node: Readline Killing Commands395858
|
||||
Node: Readline Arguments397881
|
||||
Node: Searching398971
|
||||
Node: Readline Init File401214
|
||||
Node: Readline Init File Syntax402517
|
||||
Node: Conditional Init Constructs429468
|
||||
Node: Sample Init File433853
|
||||
Node: Bindable Readline Commands436973
|
||||
Node: Commands For Moving438511
|
||||
Node: Commands For History440975
|
||||
Node: Commands For Text447132
|
||||
Node: Commands For Killing451257
|
||||
Node: Numeric Arguments454045
|
||||
Node: Commands For Completion455197
|
||||
Node: Keyboard Macros460893
|
||||
Node: Miscellaneous Commands461594
|
||||
Node: Readline vi Mode469137
|
||||
Node: Programmable Completion470114
|
||||
Node: Programmable Completion Builtins479850
|
||||
Node: A Programmable Completion Example491587
|
||||
Node: Using History Interactively496932
|
||||
Node: Bash History Facilities497613
|
||||
Node: Bash History Builtins501348
|
||||
Node: History Interaction508943
|
||||
Node: Event Designators513893
|
||||
Node: Word Designators515471
|
||||
Node: Modifiers517863
|
||||
Node: Installing Bash519800
|
||||
Node: Basic Installation520916
|
||||
Node: Compilers and Options524792
|
||||
Node: Compiling For Multiple Architectures525542
|
||||
Node: Installation Names527295
|
||||
Node: Specifying the System Type529529
|
||||
Node: Sharing Defaults530275
|
||||
Node: Operation Controls530989
|
||||
Node: Optional Features532008
|
||||
Node: Reporting Bugs544731
|
||||
Node: Major Differences From The Bourne Shell546088
|
||||
Node: GNU Free Documentation License567515
|
||||
Node: Indexes592692
|
||||
Node: Builtin Index593143
|
||||
Node: Reserved Word Index600241
|
||||
Node: Variable Index602686
|
||||
Node: Function Index620099
|
||||
Node: Concept Index634524
|
||||
Node: Special Builtins250104
|
||||
Node: Shell Variables251093
|
||||
Node: Bourne Shell Variables251527
|
||||
Node: Bash Variables254035
|
||||
Node: Bash Features293339
|
||||
Node: Invoking Bash294353
|
||||
Node: Bash Startup Files301583
|
||||
Node: Interactive Shells306943
|
||||
Node: What is an Interactive Shell?307351
|
||||
Node: Is this Shell Interactive?308013
|
||||
Node: Interactive Shell Behavior308837
|
||||
Node: Bash Conditional Expressions312598
|
||||
Node: Shell Arithmetic318015
|
||||
Node: Aliases321342
|
||||
Node: Arrays324476
|
||||
Node: The Directory Stack332579
|
||||
Node: Directory Stack Builtins333376
|
||||
Node: Controlling the Prompt337821
|
||||
Node: The Restricted Shell340940
|
||||
Node: Bash POSIX Mode344033
|
||||
Node: Shell Compatibility Mode363992
|
||||
Node: Job Control372999
|
||||
Node: Job Control Basics373456
|
||||
Node: Job Control Builtins379824
|
||||
Node: Job Control Variables386612
|
||||
Node: Command Line Editing387843
|
||||
Node: Introduction and Notation389546
|
||||
Node: Readline Interaction391898
|
||||
Node: Readline Bare Essentials393086
|
||||
Node: Readline Movement Commands394894
|
||||
Node: Readline Killing Commands395890
|
||||
Node: Readline Arguments397913
|
||||
Node: Searching399003
|
||||
Node: Readline Init File401246
|
||||
Node: Readline Init File Syntax402549
|
||||
Node: Conditional Init Constructs429500
|
||||
Node: Sample Init File433885
|
||||
Node: Bindable Readline Commands437005
|
||||
Node: Commands For Moving438543
|
||||
Node: Commands For History441007
|
||||
Node: Commands For Text447164
|
||||
Node: Commands For Killing451289
|
||||
Node: Numeric Arguments454077
|
||||
Node: Commands For Completion455229
|
||||
Node: Keyboard Macros460925
|
||||
Node: Miscellaneous Commands461626
|
||||
Node: Readline vi Mode469169
|
||||
Node: Programmable Completion470146
|
||||
Node: Programmable Completion Builtins479882
|
||||
Node: A Programmable Completion Example491619
|
||||
Node: Using History Interactively496964
|
||||
Node: Bash History Facilities497645
|
||||
Node: Bash History Builtins502311
|
||||
Node: History Interaction509906
|
||||
Node: Event Designators514856
|
||||
Node: Word Designators516434
|
||||
Node: Modifiers518826
|
||||
Node: Installing Bash520763
|
||||
Node: Basic Installation521879
|
||||
Node: Compilers and Options525755
|
||||
Node: Compiling For Multiple Architectures526505
|
||||
Node: Installation Names528258
|
||||
Node: Specifying the System Type530492
|
||||
Node: Sharing Defaults531238
|
||||
Node: Operation Controls531952
|
||||
Node: Optional Features532971
|
||||
Node: Reporting Bugs545694
|
||||
Node: Major Differences From The Bourne Shell547051
|
||||
Node: GNU Free Documentation License568478
|
||||
Node: Indexes593655
|
||||
Node: Builtin Index594106
|
||||
Node: Reserved Word Index601204
|
||||
Node: Variable Index603649
|
||||
Node: Function Index621062
|
||||
Node: Concept Index635487
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user