more error checking for hash builtin; fix for [[ builtin and some test syntax errors

This commit is contained in:
Chet Ramey
2023-09-13 16:25:28 -04:00
parent 32826f717d
commit 94bce520e8
25 changed files with 1898 additions and 1707 deletions
+103
View File
@@ -19,6 +19,7 @@ config.h
config.status
config.cache
config.log
configure~
autom4te.cache
@@ -87,3 +88,105 @@ tests/zecho
parser-built
y.tab.c
y.tab.h
# doc files created as part of making dvi versions from texinfo source
doc/bashref.aux
doc/bashref.bt
doc/bashref.bts
doc/bashref.cp
doc/bashref.cps
doc/bashref.fn
doc/bashref.fns
doc/bashref.ky
doc/bashref.pg
doc/bashref.rw
doc/bashref.rws
doc/bashref.toc
doc/bashref.tp
doc/bashref.vr
doc/bashref.vrs
lib/readline/doc/history.aux
lib/readline/doc/history.bt
lib/readline/doc/history.cp
lib/readline/doc/history.cps
lib/readline/doc/history.fn
lib/readline/doc/history.fns
lib/readline/doc/history.ky
lib/readline/doc/history.log
lib/readline/doc/history.pg
lib/readline/doc/history.toc
lib/readline/doc/history.tp
lib/readline/doc/history.vr
lib/readline/doc/history.vrs
lib/readline/doc/rlman.aux
lib/readline/doc/rlman.bt
lib/readline/doc/rlman.cp
lib/readline/doc/rlman.cps
lib/readline/doc/rlman.fn
lib/readline/doc/rlman.fns
lib/readline/doc/rlman.ky
lib/readline/doc/rlman.log
lib/readline/doc/rlman.pg
lib/readline/doc/rlman.toc
lib/readline/doc/rlman.tp
lib/readline/doc/rlman.vr
lib/readline/doc/rlman.vrs
lib/readline/doc/rluserman.aux
lib/readline/doc/rluserman.bt
lib/readline/doc/rluserman.cp
lib/readline/doc/rluserman.cps
lib/readline/doc/rluserman.fn
lib/readline/doc/rluserman.fns
lib/readline/doc/rluserman.ky
lib/readline/doc/rluserman.log
lib/readline/doc/rluserman.pg
lib/readline/doc/rluserman.toc
lib/readline/doc/rluserman.tp
lib/readline/doc/rluserman.vr
lib/readline/doc/rluserman.vrs
# example loadable builtins
examples/loadables/accept
examples/loadables/asort
examples/loadables/basename
examples/loadables/cat
examples/loadables/csv
examples/loadables/cut
examples/loadables/dirname
examples/loadables/dsv
examples/loadables/fdflags
examples/loadables/finfo
examples/loadables/getconf
examples/loadables/head
examples/loadables/hello
examples/loadables/id
examples/loadables/kv
examples/loadables/ln
examples/loadables/logname
examples/loadables/mkdir
examples/loadables/mkfifo
examples/loadables/mktemp
examples/loadables/mypid
examples/loadables/necho
examples/loadables/pathchk
examples/loadables/print
examples/loadables/printenv
examples/loadables/push
examples/loadables/pushd
examples/loadables/realpath
examples/loadables/rm
examples/loadables/rmdir
examples/loadables/seq
examples/loadables/setpgid
examples/loadables/sleep
examples/loadables/stat
examples/loadables/strftime
examples/loadables/sync
examples/loadables/tee
examples/loadables/truefalse
examples/loadables/tty
examples/loadables/uname
examples/loadables/unlink
examples/loadables/whoami
+29
View File
@@ -7579,3 +7579,32 @@ builtins/printf.def
- printf_builtin: when parsing the format string, consume entire
multibyte characters at a time unless they begin with '\\' or '%',
to avoid characters whose encoding contains those characters
9/11
----
builtins/hash.def
- hash_builtin: if the -p option is supplied without a name to hash,
it's an error
hashcmd.c
- phash_remove: if the hash table is empty, return 1 like unalias does
when the alias isn't in the hash table.
Report from from Mike Jonkmans <bashbug@jonkmans.nl>
9/13
----
test.c
- binary_test,unary_test: now static
- cond_test: new function, calls binary_test or unary_test as appropriate
and handles longjmps from test_syntax_error
test.h
- cond_test: extern declaration
execute_cmd.c
- execute_cond_node: call cond_test instead of binary_test or unary_test.
From a report and patch fro Grisha Levit <grishalevit@gmail.com>
doc/bash.1,doc/bashref.texi
- hash: add some text about the mutual exclusivity of the -t, -p, and
-d options
+9 -1
View File
@@ -126,8 +126,16 @@ hash_builtin (WORD_LIST *list)
return (EXECUTION_FAILURE);
}
/* It's an error to specify a pathname to hash to, but no name to hash. */
if (pathname && list == 0)
{
builtin_usage ();
return (EX_USAGE);
}
/* We want hash -r to be silent, but hash -- to print hashing info, so
we test expunge_hash_table. */
if (list == 0 && expunge_hash_table == 0)
{
opt = print_hashed_commands (list_portably);
@@ -144,7 +152,7 @@ hash_builtin (WORD_LIST *list)
/* If someone runs `hash -r -t xyz' he will be disappointed. */
if (list_targets)
return (list_hashed_filename_targets (list, list_portably));
#if defined (RESTRICTED_SHELL)
if (restricted && pathname)
{
+697 -694
View File
File diff suppressed because it is too large Load Diff
+9 -4
View File
@@ -5,14 +5,14 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Aug 31 15:47:46 EDT 2023
.\" Last Change: Wed Sep 13 15:39:24 EDT 2023
.\"
.\" bash_builtins, strip all but Built-Ins section
.\" avoid a warning about an undefined register
.\" .if !rzY .nr zY 0
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2023 August 31" "GNU Bash 5.3"
.TH BASH 1 "2023 September 13" "GNU Bash 5.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -9191,9 +9191,9 @@ the directories in
and remembered. Any previously-remembered pathname is discarded.
If the
.B \-p
option is supplied, no path search is performed, and
option is supplied, \fBhash\fP uses
.I filename
is used as the full filename of the command.
as the full filename of the command.
The
.B \-r
option causes the shell to forget all
@@ -9212,6 +9212,11 @@ The
option causes output to be displayed in a format that may be reused as input.
If no arguments are given, or if only \fB\-l\fP is supplied,
information about remembered commands is printed.
The \fB\-t\fP, \fB\-d\fP, and \fB\-p\fP options (the options that
act on the \fIname\fP arguments) are mutually exclusive.
Only one will be active.
If more than one is supplied, \fB\-t\fP has higher priority than
\fB\-p\fP, and both are higher priority than \fB\-d\fP.
The return status is true unless a
.I name
is not found or an invalid option is supplied.
+153 -149
View File
@@ -1,9 +1,9 @@
This is bash.info, produced by makeinfo version 6.8 from bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 31 August 2023).
Bash shell (version 5.3, 13 September 2023).
This is Edition 5.3, last updated 31 August 2023, of 'The GNU Bash
This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Copyright (C) 1988-2023 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.3, 31 August 2023). The Bash home page is
Bash shell (version 5.3, 13 September 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 31 August 2023, of 'The GNU Bash
This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -3473,8 +3473,12 @@ standard.
before the hashed full pathname. The '-l' option causes output to
be displayed in a format that may be reused as input. If no
arguments are given, or if only '-l' is supplied, information about
remembered commands is printed. The return status is zero unless a
NAME is not found or an invalid option is supplied.
remembered commands is printed. The '-t', '-d', and '-p' options
(the options that act on the NAME arguments) are mutually
exclusive. Only one will be active. If more than one is supplied,
'-t' has higher priority than '-p', and both are higher priority
than '-d'. The return status is zero unless a NAME is not found or
an invalid option is supplied.
'pwd'
pwd [-LP]
@@ -12104,7 +12108,7 @@ D.1 Index of Shell Builtin Commands
* :: Bourne Shell Builtins.
(line 11)
* [: Bourne Shell Builtins.
(line 281)
(line 285)
* alias: Bash Builtins. (line 11)
* bg: Job Control Builtins.
(line 7)
@@ -12166,36 +12170,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 218)
(line 222)
* read: Bash Builtins. (line 514)
* readarray: Bash Builtins. (line 617)
* readonly: Bourne Shell Builtins.
(line 228)
(line 232)
* return: Bourne Shell Builtins.
(line 247)
(line 251)
* set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins.
(line 268)
(line 272)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 626)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
(line 281)
(line 285)
* times: Bourne Shell Builtins.
(line 383)
(line 387)
* trap: Bourne Shell Builtins.
(line 389)
(line 393)
* true: Bourne Shell Builtins.
(line 451)
(line 455)
* type: Bash Builtins. (line 631)
* typeset: Bash Builtins. (line 669)
* ulimit: Bash Builtins. (line 675)
* umask: Bourne Shell Builtins.
(line 456)
(line 460)
* unalias: Bash Builtins. (line 781)
* unset: Bourne Shell Builtins.
(line 474)
(line 478)
* wait: Job Control Builtins.
(line 76)
@@ -12869,138 +12873,138 @@ D.5 Concept Index

Tag Table:
Node: Top890
Node: Introduction2803
Node: What is Bash?3016
Node: What is a shell?4127
Node: Definitions6662
Node: Basic Shell Features9610
Node: Shell Syntax10826
Node: Shell Operation11849
Node: Quoting13139
Node: Escape Character14440
Node: Single Quotes14922
Node: Double Quotes15267
Node: ANSI-C Quoting16542
Node: Locale Translation17851
Node: Creating Internationalized Scripts19159
Node: Comments23273
Node: Shell Commands23888
Node: Reserved Words24823
Node: Simple Commands25576
Node: Pipelines26227
Node: Lists29210
Node: Compound Commands31002
Node: Looping Constructs32011
Node: Conditional Constructs34503
Node: Command Grouping48988
Node: Coprocesses50463
Node: GNU Parallel53123
Node: Shell Functions54037
Node: Shell Parameters61919
Node: Positional Parameters66304
Node: Special Parameters67203
Node: Shell Expansions70414
Node: Brace Expansion72499
Node: Tilde Expansion75230
Node: Shell Parameter Expansion77848
Node: Command Substitution96438
Node: Arithmetic Expansion99899
Node: Process Substitution100864
Node: Word Splitting101981
Node: Filename Expansion104026
Node: Pattern Matching106956
Node: Quote Removal111955
Node: Redirections112247
Node: Executing Commands121937
Node: Simple Command Expansion122604
Node: Command Search and Execution124711
Node: Command Execution Environment127095
Node: Environment130127
Node: Exit Status131787
Node: Signals133568
Node: Shell Scripts137014
Node: Shell Builtin Commands140038
Node: Bourne Shell Builtins142073
Node: Bash Builtins165206
Node: Modifying Shell Behavior198142
Node: The Set Builtin198484
Node: The Shopt Builtin209455
Node: Special Builtins225590
Node: Shell Variables226566
Node: Bourne Shell Variables227000
Node: Bash Variables229101
Node: Bash Features264157
Node: Invoking Bash265167
Node: Bash Startup Files271203
Node: Interactive Shells276331
Node: What is an Interactive Shell?276739
Node: Is this Shell Interactive?277385
Node: Interactive Shell Behavior278197
Node: Bash Conditional Expressions281823
Node: Shell Arithmetic286733
Node: Aliases289691
Node: Arrays292582
Node: The Directory Stack299213
Node: Directory Stack Builtins299994
Node: Controlling the Prompt304251
Node: The Restricted Shell307213
Node: Bash POSIX Mode309820
Node: Shell Compatibility Mode325978
Node: Job Control334219
Node: Job Control Basics334676
Node: Job Control Builtins339675
Node: Job Control Variables345467
Node: Command Line Editing346620
Node: Introduction and Notation348288
Node: Readline Interaction349908
Node: Readline Bare Essentials351096
Node: Readline Movement Commands352882
Node: Readline Killing Commands353839
Node: Readline Arguments355757
Node: Searching356798
Node: Readline Init File358981
Node: Readline Init File Syntax360239
Node: Conditional Init Constructs384261
Node: Sample Init File388454
Node: Bindable Readline Commands391575
Node: Commands For Moving392776
Node: Commands For History394824
Node: Commands For Text399815
Node: Commands For Killing403790
Node: Numeric Arguments406491
Node: Commands For Completion407627
Node: Keyboard Macros411815
Node: Miscellaneous Commands412500
Node: Readline vi Mode418535
Node: Programmable Completion419439
Node: Programmable Completion Builtins427216
Node: A Programmable Completion Example438333
Node: Using History Interactively443578
Node: Bash History Facilities444259
Node: Bash History Builtins447267
Node: History Interaction452355
Node: Event Designators456165
Node: Word Designators457700
Node: Modifiers459562
Node: Installing Bash461367
Node: Basic Installation462501
Node: Compilers and Options466220
Node: Compiling For Multiple Architectures466958
Node: Installation Names468647
Node: Specifying the System Type470753
Node: Sharing Defaults471467
Node: Operation Controls472137
Node: Optional Features473092
Node: Reporting Bugs484308
Node: Major Differences From The Bourne Shell485639
Node: GNU Free Documentation License502494
Node: Indexes527668
Node: Builtin Index528119
Node: Reserved Word Index535217
Node: Variable Index537662
Node: Function Index554793
Node: Concept Index568511
Node: Top896
Node: Introduction2815
Node: What is Bash?3028
Node: What is a shell?4139
Node: Definitions6674
Node: Basic Shell Features9622
Node: Shell Syntax10838
Node: Shell Operation11861
Node: Quoting13151
Node: Escape Character14452
Node: Single Quotes14934
Node: Double Quotes15279
Node: ANSI-C Quoting16554
Node: Locale Translation17863
Node: Creating Internationalized Scripts19171
Node: Comments23285
Node: Shell Commands23900
Node: Reserved Words24835
Node: Simple Commands25588
Node: Pipelines26239
Node: Lists29222
Node: Compound Commands31014
Node: Looping Constructs32023
Node: Conditional Constructs34515
Node: Command Grouping49000
Node: Coprocesses50475
Node: GNU Parallel53135
Node: Shell Functions54049
Node: Shell Parameters61931
Node: Positional Parameters66316
Node: Special Parameters67215
Node: Shell Expansions70426
Node: Brace Expansion72511
Node: Tilde Expansion75242
Node: Shell Parameter Expansion77860
Node: Command Substitution96450
Node: Arithmetic Expansion99911
Node: Process Substitution100876
Node: Word Splitting101993
Node: Filename Expansion104038
Node: Pattern Matching106968
Node: Quote Removal111967
Node: Redirections112259
Node: Executing Commands121949
Node: Simple Command Expansion122616
Node: Command Search and Execution124723
Node: Command Execution Environment127107
Node: Environment130139
Node: Exit Status131799
Node: Signals133580
Node: Shell Scripts137026
Node: Shell Builtin Commands140050
Node: Bourne Shell Builtins142085
Node: Bash Builtins165474
Node: Modifying Shell Behavior198410
Node: The Set Builtin198752
Node: The Shopt Builtin209723
Node: Special Builtins225858
Node: Shell Variables226834
Node: Bourne Shell Variables227268
Node: Bash Variables229369
Node: Bash Features264425
Node: Invoking Bash265435
Node: Bash Startup Files271471
Node: Interactive Shells276599
Node: What is an Interactive Shell?277007
Node: Is this Shell Interactive?277653
Node: Interactive Shell Behavior278465
Node: Bash Conditional Expressions282091
Node: Shell Arithmetic287001
Node: Aliases289959
Node: Arrays292850
Node: The Directory Stack299481
Node: Directory Stack Builtins300262
Node: Controlling the Prompt304519
Node: The Restricted Shell307481
Node: Bash POSIX Mode310088
Node: Shell Compatibility Mode326246
Node: Job Control334487
Node: Job Control Basics334944
Node: Job Control Builtins339943
Node: Job Control Variables345735
Node: Command Line Editing346888
Node: Introduction and Notation348556
Node: Readline Interaction350176
Node: Readline Bare Essentials351364
Node: Readline Movement Commands353150
Node: Readline Killing Commands354107
Node: Readline Arguments356025
Node: Searching357066
Node: Readline Init File359249
Node: Readline Init File Syntax360507
Node: Conditional Init Constructs384529
Node: Sample Init File388722
Node: Bindable Readline Commands391843
Node: Commands For Moving393044
Node: Commands For History395092
Node: Commands For Text400083
Node: Commands For Killing404058
Node: Numeric Arguments406759
Node: Commands For Completion407895
Node: Keyboard Macros412083
Node: Miscellaneous Commands412768
Node: Readline vi Mode418803
Node: Programmable Completion419707
Node: Programmable Completion Builtins427484
Node: A Programmable Completion Example438601
Node: Using History Interactively443846
Node: Bash History Facilities444527
Node: Bash History Builtins447535
Node: History Interaction452623
Node: Event Designators456433
Node: Word Designators457968
Node: Modifiers459830
Node: Installing Bash461635
Node: Basic Installation462769
Node: Compilers and Options466488
Node: Compiling For Multiple Architectures467226
Node: Installation Names468915
Node: Specifying the System Type471021
Node: Sharing Defaults471735
Node: Operation Controls472405
Node: Optional Features473360
Node: Reporting Bugs484576
Node: Major Differences From The Bourne Shell485907
Node: GNU Free Documentation License502762
Node: Indexes527936
Node: Builtin Index528387
Node: Reserved Word Index535485
Node: Variable Index537930
Node: Function Index555061
Node: Concept Index568779

End Tag Table
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -165,7 +165,7 @@
@xrdef{The Shopt Builtin-pg}{73}
@xrdef{Special Builtins-title}{Special Builtins}
@xrdef{Special Builtins-snt}{Section@tie 4.4}
@xrdef{Special Builtins-pg}{79}
@xrdef{Special Builtins-pg}{80}
@xrdef{Shell Variables-title}{Shell Variables}
@xrdef{Shell Variables-snt}{Chapter@tie 5}
@xrdef{Bourne Shell Variables-title}{Bourne Shell Variables}
+2 -2
View File
@@ -14,8 +14,8 @@
\entry{readonly}{53}{\code {readonly}}
\entry{return}{53}{\code {return}}
\entry{shift}{53}{\code {shift}}
\entry{test}{53}{\code {test}}
\entry{[}{53}{\code {[}}
\entry{test}{54}{\code {test}}
\entry{[}{54}{\code {[}}
\entry{times}{55}{\code {times}}
\entry{trap}{55}{\code {trap}}
\entry{true}{56}{\code {true}}
+2 -2
View File
@@ -3,7 +3,7 @@
\initial {:}
\entry{\code {:}}{49}
\initial {[}
\entry{\code {[}}{53}
\entry{\code {[}}{54}
\initial {A}
\entry{\code {alias}}{57}
\initial {B}
@@ -67,7 +67,7 @@
\entry{\code {source}}{67}
\entry{\code {suspend}}{121}
\initial {T}
\entry{\code {test}}{53}
\entry{\code {test}}{54}
\entry{\code {times}}{55}
\entry{\code {trap}}{55}
\entry{\code {true}}{56}
+1 -1
View File
@@ -74,7 +74,7 @@
\entry{exit status}{45}{exit status}
\entry{signal handling}{46}{signal handling}
\entry{shell script}{47}{shell script}
\entry{special builtin}{79}{special builtin}
\entry{special builtin}{80}{special builtin}
\entry{login shell}{96}{login shell}
\entry{interactive shell}{96}{interactive shell}
\entry{startup files}{96}{startup files}
+1 -1
View File
@@ -128,7 +128,7 @@
\entry{shell, interactive}{97}
\entry{signal}{4}
\entry{signal handling}{46}
\entry{special builtin}{4, 79}
\entry{special builtin}{4, 80}
\entry{startup files}{96}
\entry{string translations}{7}
\entry{suspending jobs}{118}
+153 -149
View File
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.8 from
bashref.texi.
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 31 August 2023).
Bash shell (version 5.3, 13 September 2023).
This is Edition 5.3, last updated 31 August 2023, of 'The GNU Bash
This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@@ -27,10 +27,10 @@ Bash Features
*************
This text is a brief description of the features that are present in the
Bash shell (version 5.3, 31 August 2023). The Bash home page is
Bash shell (version 5.3, 13 September 2023). The Bash home page is
<http://www.gnu.org/software/bash/>.
This is Edition 5.3, last updated 31 August 2023, of 'The GNU Bash
This is Edition 5.3, last updated 13 September 2023, of 'The GNU Bash
Reference Manual', for 'Bash', Version 5.3.
Bash contains features that appear in other popular shells, and some
@@ -3474,8 +3474,12 @@ standard.
before the hashed full pathname. The '-l' option causes output to
be displayed in a format that may be reused as input. If no
arguments are given, or if only '-l' is supplied, information about
remembered commands is printed. The return status is zero unless a
NAME is not found or an invalid option is supplied.
remembered commands is printed. The '-t', '-d', and '-p' options
(the options that act on the NAME arguments) are mutually
exclusive. Only one will be active. If more than one is supplied,
'-t' has higher priority than '-p', and both are higher priority
than '-d'. The return status is zero unless a NAME is not found or
an invalid option is supplied.
'pwd'
pwd [-LP]
@@ -12105,7 +12109,7 @@ D.1 Index of Shell Builtin Commands
* :: Bourne Shell Builtins.
(line 11)
* [: Bourne Shell Builtins.
(line 281)
(line 285)
* alias: Bash Builtins. (line 11)
* bg: Job Control Builtins.
(line 7)
@@ -12167,36 +12171,36 @@ D.1 Index of Shell Builtin Commands
* pushd: Directory Stack Builtins.
(line 69)
* pwd: Bourne Shell Builtins.
(line 218)
(line 222)
* read: Bash Builtins. (line 514)
* readarray: Bash Builtins. (line 617)
* readonly: Bourne Shell Builtins.
(line 228)
(line 232)
* return: Bourne Shell Builtins.
(line 247)
(line 251)
* set: The Set Builtin. (line 11)
* shift: Bourne Shell Builtins.
(line 268)
(line 272)
* shopt: The Shopt Builtin. (line 9)
* source: Bash Builtins. (line 626)
* suspend: Job Control Builtins.
(line 116)
* test: Bourne Shell Builtins.
(line 281)
(line 285)
* times: Bourne Shell Builtins.
(line 383)
(line 387)
* trap: Bourne Shell Builtins.
(line 389)
(line 393)
* true: Bourne Shell Builtins.
(line 451)
(line 455)
* type: Bash Builtins. (line 631)
* typeset: Bash Builtins. (line 669)
* ulimit: Bash Builtins. (line 675)
* umask: Bourne Shell Builtins.
(line 456)
(line 460)
* unalias: Bash Builtins. (line 781)
* unset: Bourne Shell Builtins.
(line 474)
(line 478)
* wait: Job Control Builtins.
(line 76)
@@ -12870,138 +12874,138 @@ D.5 Concept Index

Tag Table:
Node: Top893
Node: Introduction2809
Node: What is Bash?3025
Node: What is a shell?4139
Node: Definitions6677
Node: Basic Shell Features9628
Node: Shell Syntax10847
Node: Shell Operation11873
Node: Quoting13166
Node: Escape Character14470
Node: Single Quotes14955
Node: Double Quotes15303
Node: ANSI-C Quoting16581
Node: Locale Translation17893
Node: Creating Internationalized Scripts19204
Node: Comments23321
Node: Shell Commands23939
Node: Reserved Words24877
Node: Simple Commands25633
Node: Pipelines26287
Node: Lists29273
Node: Compound Commands31068
Node: Looping Constructs32080
Node: Conditional Constructs34575
Node: Command Grouping49063
Node: Coprocesses50541
Node: GNU Parallel53204
Node: Shell Functions54121
Node: Shell Parameters62006
Node: Positional Parameters66394
Node: Special Parameters67296
Node: Shell Expansions70510
Node: Brace Expansion72598
Node: Tilde Expansion75332
Node: Shell Parameter Expansion77953
Node: Command Substitution96546
Node: Arithmetic Expansion100010
Node: Process Substitution100978
Node: Word Splitting102098
Node: Filename Expansion104146
Node: Pattern Matching107079
Node: Quote Removal112081
Node: Redirections112376
Node: Executing Commands122069
Node: Simple Command Expansion122739
Node: Command Search and Execution124849
Node: Command Execution Environment127236
Node: Environment130271
Node: Exit Status131934
Node: Signals133718
Node: Shell Scripts137167
Node: Shell Builtin Commands140194
Node: Bourne Shell Builtins142232
Node: Bash Builtins165368
Node: Modifying Shell Behavior198307
Node: The Set Builtin198652
Node: The Shopt Builtin209626
Node: Special Builtins225764
Node: Shell Variables226743
Node: Bourne Shell Variables227180
Node: Bash Variables229284
Node: Bash Features264343
Node: Invoking Bash265356
Node: Bash Startup Files271395
Node: Interactive Shells276526
Node: What is an Interactive Shell?276937
Node: Is this Shell Interactive?277586
Node: Interactive Shell Behavior278401
Node: Bash Conditional Expressions282030
Node: Shell Arithmetic286943
Node: Aliases289904
Node: Arrays292798
Node: The Directory Stack299432
Node: Directory Stack Builtins300216
Node: Controlling the Prompt304476
Node: The Restricted Shell307441
Node: Bash POSIX Mode310051
Node: Shell Compatibility Mode326212
Node: Job Control334456
Node: Job Control Basics334916
Node: Job Control Builtins339918
Node: Job Control Variables345713
Node: Command Line Editing346869
Node: Introduction and Notation348540
Node: Readline Interaction350163
Node: Readline Bare Essentials351354
Node: Readline Movement Commands353143
Node: Readline Killing Commands354103
Node: Readline Arguments356024
Node: Searching357068
Node: Readline Init File359254
Node: Readline Init File Syntax360515
Node: Conditional Init Constructs384540
Node: Sample Init File388736
Node: Bindable Readline Commands391860
Node: Commands For Moving393064
Node: Commands For History395115
Node: Commands For Text400109
Node: Commands For Killing404087
Node: Numeric Arguments406791
Node: Commands For Completion407930
Node: Keyboard Macros412121
Node: Miscellaneous Commands412809
Node: Readline vi Mode418847
Node: Programmable Completion419754
Node: Programmable Completion Builtins427534
Node: A Programmable Completion Example438654
Node: Using History Interactively443902
Node: Bash History Facilities444586
Node: Bash History Builtins447597
Node: History Interaction452688
Node: Event Designators456501
Node: Word Designators458039
Node: Modifiers459904
Node: Installing Bash461712
Node: Basic Installation462849
Node: Compilers and Options466571
Node: Compiling For Multiple Architectures467312
Node: Installation Names469004
Node: Specifying the System Type471113
Node: Sharing Defaults471830
Node: Operation Controls472503
Node: Optional Features473461
Node: Reporting Bugs484680
Node: Major Differences From The Bourne Shell486014
Node: GNU Free Documentation License502872
Node: Indexes528049
Node: Builtin Index528503
Node: Reserved Word Index535604
Node: Variable Index538052
Node: Function Index555186
Node: Concept Index568907
Node: Top899
Node: Introduction2821
Node: What is Bash?3037
Node: What is a shell?4151
Node: Definitions6689
Node: Basic Shell Features9640
Node: Shell Syntax10859
Node: Shell Operation11885
Node: Quoting13178
Node: Escape Character14482
Node: Single Quotes14967
Node: Double Quotes15315
Node: ANSI-C Quoting16593
Node: Locale Translation17905
Node: Creating Internationalized Scripts19216
Node: Comments23333
Node: Shell Commands23951
Node: Reserved Words24889
Node: Simple Commands25645
Node: Pipelines26299
Node: Lists29285
Node: Compound Commands31080
Node: Looping Constructs32092
Node: Conditional Constructs34587
Node: Command Grouping49075
Node: Coprocesses50553
Node: GNU Parallel53216
Node: Shell Functions54133
Node: Shell Parameters62018
Node: Positional Parameters66406
Node: Special Parameters67308
Node: Shell Expansions70522
Node: Brace Expansion72610
Node: Tilde Expansion75344
Node: Shell Parameter Expansion77965
Node: Command Substitution96558
Node: Arithmetic Expansion100022
Node: Process Substitution100990
Node: Word Splitting102110
Node: Filename Expansion104158
Node: Pattern Matching107091
Node: Quote Removal112093
Node: Redirections112388
Node: Executing Commands122081
Node: Simple Command Expansion122751
Node: Command Search and Execution124861
Node: Command Execution Environment127248
Node: Environment130283
Node: Exit Status131946
Node: Signals133730
Node: Shell Scripts137179
Node: Shell Builtin Commands140206
Node: Bourne Shell Builtins142244
Node: Bash Builtins165636
Node: Modifying Shell Behavior198575
Node: The Set Builtin198920
Node: The Shopt Builtin209894
Node: Special Builtins226032
Node: Shell Variables227011
Node: Bourne Shell Variables227448
Node: Bash Variables229552
Node: Bash Features264611
Node: Invoking Bash265624
Node: Bash Startup Files271663
Node: Interactive Shells276794
Node: What is an Interactive Shell?277205
Node: Is this Shell Interactive?277854
Node: Interactive Shell Behavior278669
Node: Bash Conditional Expressions282298
Node: Shell Arithmetic287211
Node: Aliases290172
Node: Arrays293066
Node: The Directory Stack299700
Node: Directory Stack Builtins300484
Node: Controlling the Prompt304744
Node: The Restricted Shell307709
Node: Bash POSIX Mode310319
Node: Shell Compatibility Mode326480
Node: Job Control334724
Node: Job Control Basics335184
Node: Job Control Builtins340186
Node: Job Control Variables345981
Node: Command Line Editing347137
Node: Introduction and Notation348808
Node: Readline Interaction350431
Node: Readline Bare Essentials351622
Node: Readline Movement Commands353411
Node: Readline Killing Commands354371
Node: Readline Arguments356292
Node: Searching357336
Node: Readline Init File359522
Node: Readline Init File Syntax360783
Node: Conditional Init Constructs384808
Node: Sample Init File389004
Node: Bindable Readline Commands392128
Node: Commands For Moving393332
Node: Commands For History395383
Node: Commands For Text400377
Node: Commands For Killing404355
Node: Numeric Arguments407059
Node: Commands For Completion408198
Node: Keyboard Macros412389
Node: Miscellaneous Commands413077
Node: Readline vi Mode419115
Node: Programmable Completion420022
Node: Programmable Completion Builtins427802
Node: A Programmable Completion Example438922
Node: Using History Interactively444170
Node: Bash History Facilities444854
Node: Bash History Builtins447865
Node: History Interaction452956
Node: Event Designators456769
Node: Word Designators458307
Node: Modifiers460172
Node: Installing Bash461980
Node: Basic Installation463117
Node: Compilers and Options466839
Node: Compiling For Multiple Architectures467580
Node: Installation Names469272
Node: Specifying the System Type471381
Node: Sharing Defaults472098
Node: Operation Controls472771
Node: Optional Features473729
Node: Reporting Bugs484948
Node: Major Differences From The Bourne Shell486282
Node: GNU Free Documentation License503140
Node: Indexes528317
Node: Builtin Index528771
Node: Reserved Word Index535872
Node: Variable Index538320
Node: Function Index555454
Node: Concept Index569175

End Tag Table
+22 -21
View File
@@ -1,11 +1,12 @@
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=pdfetex 2021.8.30) 10 SEP 2023 17:14
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/MacPorts 2021.58693_0) (preloaded format=pdfetex 2021.8.30) 13 SEP 2023 15:40
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**\input /usr/local/src/bash/bash-20230907/doc/bashref.texi
(/usr/local/src/bash/bash-20230907/doc/bashref.texi
(/usr/local/src/bash/bash-20230907/doc/texinfo.tex
**\input /usr/local/src/bash/bash-20230911/doc/bashref.texi \input /usr/local/s
rc/bash/bash-20230911/doc/bashref.texi
(/usr/local/src/bash/bash-20230911/doc/bashref.texi
(/usr/local/src/bash/bash-20230911/doc/texinfo.tex
Loading texinfo [version 2015-11-22.14]:
\outerhsize=\dimen16
\outervsize=\dimen17
@@ -161,15 +162,15 @@ This is `epsf.tex' v2.7.4 <14 February 2011>
texinfo.tex: doing @include of version.texi
(/usr/local/src/bash/bash-20230907/doc/version.texi) [1{/opt/local/var/db/texmf
(/usr/local/src/bash/bash-20230911/doc/version.texi) [1{/opt/local/var/db/texmf
/fonts/map/pdftex/updmap/pdftex.map}] [2]
(/usr/local/build/bash/bash-20230907/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20230907/doc/bashref.toc)
(/usr/local/build/bash/bash-20230907/doc/bashref.toc) Chapter 1
(/usr/local/build/bash/bash-20230911/doc/bashref.toc [-1] [-2] [-3]) [-4]
(/usr/local/build/bash/bash-20230911/doc/bashref.toc)
(/usr/local/build/bash/bash-20230911/doc/bashref.toc) Chapter 1
\openout0 = `bashref.toc'.
(/usr/local/build/bash/bash-20230907/doc/bashref.aux)
(/usr/local/build/bash/bash-20230911/doc/bashref.aux)
\openout1 = `bashref.aux'.
Chapter 2 [1] [2]
@@ -229,7 +230,7 @@ Overfull \hbox (5.95723pt too wide) in paragraph at lines 724--725
[49] [50] [51]
[52] [53] [54] [55] [56] [57] [58] [59] [60] [61] [62] [63] [64] [65] [66]
[67] [68]
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5407--5407
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5412--5412
[]@texttt set [-abefhkmnptuvxBCEHPT] [-o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -242,7 +243,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5407--5407
.etc.
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5408--5408
Overfull \hbox (38.26585pt too wide) in paragraph at lines 5413--5413
[]@texttt set [+abefhkmnptuvxBCEHPT] [+o @textttsl option-name@texttt ] [--] [
-] [@textttsl ar-gu-ment []@texttt ][]
@@ -261,7 +262,7 @@ Overfull \hbox (38.26585pt too wide) in paragraph at lines 5408--5408
[119] [120]
texinfo.tex: doing @include of rluser.texi
(/usr/local/src/bash/bash-20230907/lib/readline/doc/rluser.texi
(/usr/local/src/bash/bash-20230911/lib/readline/doc/rluser.texi
Chapter 8 [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] [131]
[132]
Underfull \hbox (badness 7540) in paragraph at lines 878--884
@@ -311,10 +312,10 @@ gnored[]
texinfo.tex: doing @include of hsuser.texi
(/usr/local/src/bash/bash-20230907/lib/readline/doc/hsuser.texi Chapter 9
(/usr/local/src/bash/bash-20230911/lib/readline/doc/hsuser.texi Chapter 9
[158] [159] [160] [161] [162] [163]) Chapter 10 [164] [165] [166] [167]
[168]
Underfull \hbox (badness 10000) in paragraph at lines 9743--9752
Underfull \hbox (badness 10000) in paragraph at lines 9748--9757
[]@textrm All of the fol-low-ing op-tions ex-cept for `@texttt alt-array-implem
entation[]@textrm '[],
@@ -327,7 +328,7 @@ entation[]@textrm '[],
.etc.
Underfull \hbox (badness 10000) in paragraph at lines 9743--9752
Underfull \hbox (badness 10000) in paragraph at lines 9748--9757
@textrm `@texttt disabled-builtins[]@textrm '[], `@texttt direxpand-default[]@t
extrm '[], `@texttt strict-posix-default[]@textrm '[], and
@@ -343,17 +344,17 @@ extrm '[], `@texttt strict-posix-default[]@textrm '[], and
[178] [179] Appendix C [180]
texinfo.tex: doing @include of fdl.texi
(/usr/local/src/bash/bash-20230907/doc/fdl.texi
(/usr/local/src/bash/bash-20230911/doc/fdl.texi
[181] [182] [183] [184] [185] [186] [187]) Appendix D [188] [189] [190]
[191] [192] [193] [194] [195] [196] [197] )
Here is how much of TeX's memory you used:
4104 strings out of 497086
47614 string characters out of 6206517
142215 words of memory out of 5000000
142185 words of memory out of 5000000
4869 multiletter control sequences out of 15000+600000
34315 words of font info for 116 fonts, out of 8000000 for 9000
51 hyphenation exceptions out of 8191
16i,6n,16p,331b,983s stack positions out of 5000i,500n,10000p,200000b,80000s
16i,6n,16p,389b,983s stack positions out of 5000i,500n,10000p,200000b,80000s
{/opt/local/share/texmf-texlive/font
s/enc/dvips/cm-super/cm-super-t1.enc}</opt/local/share/texmf-texlive/fonts/type
1/public/amsfonts/cm/cmbx12.pfb></opt/local/share/texmf-texlive/fonts/type1/pub
@@ -371,10 +372,10 @@ texlive/fonts/type1/public/amsfonts/cm/cmtt12.pfb></opt/local/share/texmf-texli
ve/fonts/type1/public/amsfonts/cm/cmtt9.pfb></opt/local/share/texmf-texlive/fon
ts/type1/public/cm-super/sfrm1095.pfb></opt/local/share/texmf-texlive/fonts/typ
e1/public/cm-super/sfrm1440.pfb>
Output written on bashref.pdf (203 pages, 813794 bytes).
Output written on bashref.pdf (203 pages, 813912 bytes).
PDF statistics:
2825 PDF objects out of 2984 (max. 8388607)
2575 compressed objects within 26 object streams
2824 PDF objects out of 2984 (max. 8388607)
2574 compressed objects within 26 object streams
331 named destinations out of 1000 (max. 500000)
1157 words of extra memory for PDF output out of 10000 (max. 10000000)
BIN
View File
Binary file not shown.
+5
View File
@@ -4105,6 +4105,11 @@ The @option{-l} option causes output to be displayed in a format
that may be reused as input.
If no arguments are given, or if only @option{-l} is supplied,
information about remembered commands is printed.
The @option{-t}, @option{-d}, and @option{-p} options (the options that
act on the @var{name} arguments) are mutually exclusive.
Only one will be active.
If more than one is supplied, @option{-t} has higher priority than
@option{-p}, and both are higher priority than @option{-d}.
The return status is zero unless a @var{name} is not found or an invalid
option is supplied.
+1 -1
View File
@@ -63,7 +63,7 @@
@numsecentry{Modifying Shell Behavior}{4.3}{Modifying Shell Behavior}{69}
@numsubsecentry{The Set Builtin}{4.3.1}{The Set Builtin}{69}
@numsubsecentry{The Shopt Builtin}{4.3.2}{The Shopt Builtin}{73}
@numsecentry{Special Builtins}{4.4}{Special Builtins}{79}
@numsecentry{Special Builtins}{4.4}{Special Builtins}{80}
@numchapentry{Shell Variables}{5}{Shell Variables}{81}
@numsecentry{Bourne Shell Variables}{5.1}{Bourne Shell Variables}{81}
@numsecentry{Bash Variables}{5.2}{Bash Variables}{81}
+671 -668
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -2,10 +2,10 @@
Copyright (C) 1988-2023 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Thu Aug 31 15:48:06 EDT 2023
@set LASTCHANGE Wed Sep 13 15:38:31 EDT 2023
@set EDITION 5.3
@set VERSION 5.3
@set UPDATED 31 August 2023
@set UPDATED-MONTH August 2023
@set UPDATED 13 September 2023
@set UPDATED-MONTH September 2023
+2 -4
View File
@@ -3942,7 +3942,7 @@ execute_cond_node (COND_COM *cond)
if (varop)
oa = set_expand_once (0, 0); /* no-op for compatibility levels <= 51 */
#endif
result = unary_test (cond->op->word, arg1, varflag) ? EXECUTION_SUCCESS : EXECUTION_FAILURE;
result = cond_test (cond->op->word, arg1, NULL, varflag);
#if defined (ARRAY_VARS)
if (varop)
array_expand_once = oa;
@@ -4022,9 +4022,7 @@ execute_cond_node (COND_COM *cond)
#endif /* COND_REGEXP */
{
extended_glob = 1;
result = binary_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE)
? EXECUTION_SUCCESS
: EXECUTION_FAILURE;
result = cond_test (cond->op->word, arg1, arg2, TEST_PATMATCH|TEST_ARITHEXP|TEST_LOCALE);
extended_glob = extglob_flag;
}
if (arg1 != nullstr)
+4 -1
View File
@@ -66,9 +66,12 @@ phash_remove (const char *filename)
{
register BUCKET_CONTENTS *item;
if (hashing_enabled == 0 || hashed_filenames == 0)
if (hashing_enabled == 0)
return 0;
if (hashed_filenames == 0)
return 1;
item = hash_remove (filename, hashed_filenames, 0);
if (item)
{
+22 -2
View File
@@ -118,6 +118,9 @@ static void test_syntax_error (char *, char *) __attribute__((__noreturn__));
static void beyond (void) __attribute__((__noreturn__));
static void integer_expected_error (char *) __attribute__((__noreturn__));
static int unary_test (char *, char *, int);
static int binary_test (char *, char *, char *, int);
static int unary_operator (void);
static int binary_operator (void);
static int two_arguments (void);
@@ -376,7 +379,7 @@ patcomp (char *string, char *pat, int op)
return ((op == EQ) ? (m == 0) : (m != 0));
}
int
static int
binary_test (char *op, char *arg1, char *arg2, int flags)
{
int patmatch;
@@ -509,7 +512,7 @@ unary_operator (void)
return (unary_test (op, argv[pos - 1], 0));
}
int
static int
unary_test (char *op, char *arg, int flags)
{
intmax_t r;
@@ -857,6 +860,23 @@ posixtest (void)
return (value);
}
#if defined (COND_COMMAND)
int
cond_test (char *op, char *arg1, char *arg2, int flags)
{
int code, ret;
code = setjmp_nosigs (test_exit_buf);
if (code)
return (test_error_return);
ret = arg2 ? binary_test (op, arg1, arg2, flags) : unary_test (op, arg1, flags);
return (ret ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
#endif
/*
* [:
* '[' expr ']'
+1 -2
View File
@@ -32,8 +32,7 @@
extern int test_unop (char *);
extern int test_binop (char *);
extern int unary_test (char *, char *, int);
extern int binary_test (char *, char *, char *, int);
extern int cond_test (char *, char *, char *, int);
extern int test_command (int, char **);
+3 -1
View File
@@ -12,6 +12,8 @@ returns: 0
returns: 0
returns: 1
returns: 0
./cond.tests: line 65: [[: X: integer expected
returns: 2
returns: 0
returns: 1
returns: 1
@@ -27,7 +29,7 @@ returns: 0
returns: 1
returns: 1
returns: 0
./cond.tests: line 122: [[: 4+: arithmetic syntax error: operand expected (error token is "+")
./cond.tests: line 126: [[: 4+: arithmetic syntax error: operand expected (error token is "+")
returns: 1
returns: 0
returns: 0
+4
View File
@@ -61,6 +61,10 @@ echo returns: $?
[[ -z $UNSET ]]
echo returns: $?
# need to handle test syntax errors and longjmp
[[ -t X ]]
echo returns: $?
# the ==/= and != operators do pattern matching
[[ $TDIR == /usr/homes/* ]]
echo returns: $?