taking the length of an unset variable subscripted with anything but @ or * is a fatal error; quote results of u prompt expansion; posix mode changes for exiting on -e when in a shell function; fix readline redisplay issue when bold prompt spans multiple lines

This commit is contained in:
Chet Ramey
2025-01-24 11:21:16 -05:00
parent 42c49d621d
commit 25e213a551
19 changed files with 1257 additions and 1152 deletions
+36
View File
@@ -10834,3 +10834,39 @@ examples/loadables/fltexpr.c
builtins/printf.def
- getarg(), advancearg(): cosmetic changes to make it easier to
implement %N$ format specifiers in the future
1/18
----
subst.c
- array_length_reference: requesting the length of an element of an
unset variable using array syntax is a fatal error when `set -u'
is enabled and the subscript is not `@' or `*'.
Inspired by a report from Ian Kelling <iank@fsf.org>
1/20
----
parse.y
- decode_prompt_string: since Debian has made the spectaculary bad call
to allow arbitrary characters in usernames, protect the results of
the \u expansion in the same way as \[Ww] and \[Hh] (externally-
controlled data)
From https://savannah.gnu.org/patch/?10496
1/21
----
eval.c
- reader_loop: if we longjmp with ERREXIT, don't reset any local
function contexts in posix mode, since POSIX says to exit as if
executing the `exit builtin with no arguments'. Revision of change
from 7/2022.
From a report by Ivan Shapovalov <intelfx@intelfx.name> in 11/2024
lib/readline/display.c
- rl_redisplay: after calling update_line, when putting the cursor
where it needs to be and reprinting part of the line with the
prompt that contains invisible characters, make sure we start to
output characters at the portion in the prompt buffer that begins
on the current line and only offset by the number of invisible
characters on the current line, and set _rl_last_c_pos accordingly
in both multibyte and singlebyte locales.
Fixes bug reported by Andreas Schwab <schwab@linux-m68k.org>
+1
View File
@@ -1182,6 +1182,7 @@ expr.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
expr.o: make_cmd.h subst.h sig.h pathnames.h externs.h flags.h execute_cmd.h
expr.o: ${BASHINCDIR}/chartypes.h
expr.o: assoc.h ${BASHINCDIR}/ocache.h ${BASHINCDIR}/typemax.h
expr.o: $(DEFSRC)/common.h $(DEFDIR)/builtext.h
findcmd.o: config.h bashtypes.h ${BASHINCDIR}/filecntl.h ${BASHINCDIR}/posixstat.h bashansi.h
findcmd.o: ${BASHINCDIR}/ansi_stdlib.h ${BASHINCDIR}/memalloc.h shell.h syntax.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h
findcmd.o: ${BASHINCDIR}/stdc.h error.h general.h xmalloc.h variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h
+1 -1
View File
@@ -70,7 +70,7 @@ $END
#define UNSETOPT 0
#define SETOPT 1
#define OPTFMT "%-25s %s\n"
#define OPTFMT "%-20s\t%s\n"
extern int allow_null_glob_expansion, fail_glob_expansion, glob_dot_filenames;
extern int cdable_vars, mail_warning, source_uses_path;
+594 -593
View File
File diff suppressed because it is too large Load Diff
+25 -17
View File
@@ -3873,10 +3873,9 @@ ${\fIparameter\fP\fB/#\fP\fIpattern\fP\fB/\fP\fIstring\fP}
${\fIparameter\fP\fB/%\fP\fIpattern\fP\fB/\fP\fIstring\fP}
.PD
\fBPattern substitution\fP.
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion and matched against the expanded value of
\fIparameter\fP
using the rules described under
The \fIpattern\fP is expanded to produce a pattern
and matched against the expanded value of \fIparameter\fP
as described under
.B "Pattern Matching"
below.
The longest match of \fIpattern\fP
@@ -3956,18 +3955,29 @@ ${\fIparameter\fP\fB,,\fP\fIpattern\fP}
.PD
\fBCase modification\fP.
This expansion modifies the case of alphabetic characters in \fIparameter\fP.
The \fIpattern\fP is expanded to produce a pattern just as in
pathname expansion.
Each character in the expanded value of \fIparameter\fP is tested against
\fIpattern\fP, and, if it matches the pattern, its case is converted.
First, the \fIpattern\fP is expanded to produce a pattern
as described below under
.SM
.BR "Pattern Matching" .
.B Bash
then examines characters in the expanded value of \fIparameter\fP
against \fIpattern\fP as described below.
If a character matches the pattern, its case is converted.
The pattern should not attempt to match more than one character.
.IP
The \fB\*^\fP operator converts lowercase letters matching \fIpattern\fP
to uppercase; the \fB,\fP operator converts matching uppercase letters
to lowercase.
The \fB\*^\*^\fP and \fB,,\fP expansions convert each matched character in the
expanded value; the \fB\*^\fP and \fB,\fP expansions match and convert only
the first character in the expanded value.
Using
.Q \*^
converts lowercase letters matching \fIpattern\fP to uppercase;
.Q ,
converts matching uppercase letters to lowercase.
The
\fB\*^\fP and \fB,\fP variants
examine the first character in the expanded value
and convert its case if it matches \fIpattern\fP;
the
\fB\*^\*^\fP and \fB,,\fP variants
examine all characters in the expanded value
and convert each one that matches \fIpattern\fP.
If \fIpattern\fP is omitted, it is treated like a \fB?\fP, which matches
every character.
.IP
@@ -4426,7 +4436,7 @@ shell variable controls how the results of pathname expansion are sorted,
as described above under
.BR "Shell Variables" .
.PP
\fBPattern Matching\fP
.B "Pattern Matching"
.PP
Any character that appears in a pattern, other than the special pattern
characters described below, matches itself.
@@ -11873,8 +11883,6 @@ under
.B compat43
.TP 8
.B compat44
.TP 8
.B compat50
.PD
These control aspects of the shell's compatibility mode
(see
+220 -217
View File
@@ -2142,13 +2142,12 @@ omitted, the operator tests only for existence.
${PARAMETER//PATTERN/STRING}
${PARAMETER/#PATTERN/STRING}
${PARAMETER/%PATTERN/STRING}
The PATTERN is expanded to produce a pattern just as in filename
expansion and matched against the expanded value of PARAMETER
according to the rules described below (*note Pattern Matching::).
The longest match of PATTERN in the expanded value is replaced with
STRING. STRING undergoes tilde expansion, parameter and variable
expansion, arithmetic expansion, command and process substitution,
and quote removal.
The PATTERN is expanded to produce a pattern and matched against
the expanded value of PARAMETER as described below (*note Pattern
Matching::). The longest match of PATTERN in the expanded value is
replaced with STRING. STRING undergoes tilde expansion, parameter
and variable expansion, arithmetic expansion, command and process
substitution, and quote removal.
In the first form above, only the first match is replaced. If
there are two slashes separating PARAMETER and PATTERN (the second
@@ -2232,19 +2231,21 @@ omitted, the operator tests only for existence.
${PARAMETER,PATTERN}
${PARAMETER,,PATTERN}
This expansion modifies the case of alphabetic characters in
PARAMETER. The PATTERN is expanded to produce a pattern just as in
filename expansion. Each character in the expanded value of
PARAMETER is tested against PATTERN, and, if it matches the
PARAMETER. First, the PATTERN is expanded to produce a pattern as
described below in *note Pattern Matching::.
Bash then examines characters in the expanded value of PARAMETER
against PATTERN as described below. If a character matches the
pattern, its case is converted. The pattern should not attempt to
match more than one character.
The ^ operator converts lowercase letters matching PATTERN to
uppercase; the , operator converts matching uppercase letters to
lowercase. The ^^ and ,, expansions convert each matched
character in the expanded value; the ^ and , expansions match
and convert only the first character in the expanded value. If
PATTERN is omitted, it is treated like a ?, which matches every
character.
Using ^ converts lowercase letters matching PATTERN to uppercase;
, converts matching uppercase letters to lowercase. The ^ and
, variants examine the first character in the expanded value and
convert its case if it matches PATTERN; the ^^ and ,, variants
examine all characters in the expanded value and convert each one
that matches PATTERN. If PATTERN is omitted, it is treated like a
?, which matches every character.
If PARAMETER is @ or *, the case modification operation is
applied to each positional parameter in turn, and the expansion is
@@ -5633,8 +5634,9 @@ Variables::).
command (*note The Shopt Builtin::). The options appearing in
BASHOPTS are those reported as on by shopt. If this variable
is in the environment when Bash starts up, the shell enables each
option in the list before reading any startup files. This variable
is readonly.
option in the list before reading any startup files. If this
variable is exported, child shells will enable each option in the
list. This variable is readonly.
BASHPID
Expands to the process ID of the current Bash process. This
@@ -11115,8 +11117,9 @@ expansion uses the entire event. A : separates the event
specification from the word designator. It may be omitted if the word
designator begins with a ^, $, *, -, or %. Words are numbered
from the beginning of the line, with the first word being denoted by 0
(zero). Words are inserted into the current line separated by single
spaces.
(zero). That first word is usually the command word, and the arguments
begin with the second word. Words are inserted into the current line
separated by single spaces.
For example,
@@ -11125,7 +11128,7 @@ spaces.
preceding command is repeated in toto.
!!:$
designates the last argument of the preceding command. This may be
designates the last word of the preceding command. This may be
shortened to !$.
!fi:2
@@ -12938,27 +12941,27 @@ D.3 Parameter and Variable Index
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 24)
* BASH_ALIASES: Bash Variables. (line 43)
* BASH_ARGC: Bash Variables. (line 52)
* BASH_ARGV: Bash Variables. (line 66)
* BASH_ARGV0: Bash Variables. (line 79)
* BASH_CMDS: Bash Variables. (line 87)
* BASH_COMMAND: Bash Variables. (line 96)
* BASH_COMPAT: Bash Variables. (line 103)
* BASH_ENV: Bash Variables. (line 119)
* BASH_EXECUTION_STRING: Bash Variables. (line 125)
* BASH_LINENO: Bash Variables. (line 128)
* BASH_LOADABLES_PATH: Bash Variables. (line 138)
* BASH_MONOSECONDS: Bash Variables. (line 142)
* BASH_REMATCH: Bash Variables. (line 149)
* BASH_SOURCE: Bash Variables. (line 157)
* BASH_SUBSHELL: Bash Variables. (line 165)
* BASH_TRAPSIG: Bash Variables. (line 171)
* BASH_VERSINFO: Bash Variables. (line 177)
* BASH_VERSION: Bash Variables. (line 200)
* BASH_XTRACEFD: Bash Variables. (line 204)
* BASH_ALIASES: Bash Variables. (line 44)
* BASH_ARGC: Bash Variables. (line 53)
* BASH_ARGV: Bash Variables. (line 67)
* BASH_ARGV0: Bash Variables. (line 80)
* BASH_CMDS: Bash Variables. (line 88)
* BASH_COMMAND: Bash Variables. (line 97)
* BASH_COMPAT: Bash Variables. (line 104)
* BASH_ENV: Bash Variables. (line 120)
* BASH_EXECUTION_STRING: Bash Variables. (line 126)
* BASH_LINENO: Bash Variables. (line 129)
* BASH_LOADABLES_PATH: Bash Variables. (line 139)
* BASH_MONOSECONDS: Bash Variables. (line 143)
* BASH_REMATCH: Bash Variables. (line 150)
* BASH_SOURCE: Bash Variables. (line 158)
* BASH_SUBSHELL: Bash Variables. (line 166)
* BASH_TRAPSIG: Bash Variables. (line 172)
* BASH_VERSINFO: Bash Variables. (line 178)
* BASH_VERSION: Bash Variables. (line 201)
* BASH_XTRACEFD: Bash Variables. (line 205)
* BASHOPTS: Bash Variables. (line 27)
* BASHPID: Bash Variables. (line 36)
* BASHPID: Bash Variables. (line 37)
* bell-style: Readline Init File Syntax.
(line 64)
* bind-tty-special-chars: Readline Init File Syntax.
@@ -12967,21 +12970,21 @@ D.3 Parameter and Variable Index
(line 79)
* CDPATH: Bourne Shell Variables.
(line 9)
* CHILD_MAX: Bash Variables. (line 216)
* CHILD_MAX: Bash Variables. (line 217)
* colored-completion-prefix: Readline Init File Syntax.
(line 84)
* colored-stats: Readline Init File Syntax.
(line 94)
* COLUMNS: Bash Variables. (line 223)
* COLUMNS: Bash Variables. (line 224)
* comment-begin: Readline Init File Syntax.
(line 100)
* COMP_CWORD: Bash Variables. (line 229)
* COMP_KEY: Bash Variables. (line 235)
* COMP_LINE: Bash Variables. (line 241)
* COMP_POINT: Bash Variables. (line 246)
* COMP_TYPE: Bash Variables. (line 254)
* COMP_WORDBREAKS: Bash Variables. (line 264)
* COMP_WORDS: Bash Variables. (line 270)
* COMP_CWORD: Bash Variables. (line 230)
* COMP_KEY: Bash Variables. (line 236)
* COMP_LINE: Bash Variables. (line 242)
* COMP_POINT: Bash Variables. (line 247)
* COMP_TYPE: Bash Variables. (line 255)
* COMP_WORDBREAKS: Bash Variables. (line 265)
* COMP_WORDS: Bash Variables. (line 271)
* completion-display-width: Readline Init File Syntax.
(line 104)
* completion-ignore-case: Readline Init File Syntax.
@@ -12992,18 +12995,18 @@ D.3 Parameter and Variable Index
(line 122)
* completion-query-items: Readline Init File Syntax.
(line 131)
* COMPREPLY: Bash Variables. (line 277)
* COMPREPLY: Bash Variables. (line 278)
* convert-meta: Readline Init File Syntax.
(line 142)
* COPROC: Bash Variables. (line 283)
* DIRSTACK: Bash Variables. (line 287)
* COPROC: Bash Variables. (line 284)
* DIRSTACK: Bash Variables. (line 288)
* disable-completion: Readline Init File Syntax.
(line 154)
* echo-control-characters: Readline Init File Syntax.
(line 159)
* editing-mode: Readline Init File Syntax.
(line 164)
* EMACS: Bash Variables. (line 297)
* EMACS: Bash Variables. (line 298)
* emacs-mode-string: Readline Init File Syntax.
(line 170)
* enable-active-region The: Readline Init File Syntax.
@@ -13014,72 +13017,72 @@ D.3 Parameter and Variable Index
(line 202)
* enable-meta-key: Readline Init File Syntax.
(line 207)
* ENV: Bash Variables. (line 302)
* EPOCHREALTIME: Bash Variables. (line 307)
* EPOCHSECONDS: Bash Variables. (line 315)
* EUID: Bash Variables. (line 322)
* EXECIGNORE: Bash Variables. (line 326)
* ENV: Bash Variables. (line 303)
* EPOCHREALTIME: Bash Variables. (line 308)
* EPOCHSECONDS: Bash Variables. (line 316)
* EUID: Bash Variables. (line 323)
* EXECIGNORE: Bash Variables. (line 327)
* expand-tilde: Readline Init File Syntax.
(line 217)
* FCEDIT: Bash Variables. (line 338)
* FIGNORE: Bash Variables. (line 341)
* FCEDIT: Bash Variables. (line 339)
* FIGNORE: Bash Variables. (line 342)
* force-meta-prefix: Readline Init File Syntax.
(line 221)
* FUNCNAME: Bash Variables. (line 347)
* FUNCNEST: Bash Variables. (line 364)
* GLOBIGNORE: Bash Variables. (line 369)
* GLOBSORT: Bash Variables. (line 376)
* GROUPS: Bash Variables. (line 414)
* histchars: Bash Variables. (line 420)
* HISTCMD: Bash Variables. (line 436)
* HISTCONTROL: Bash Variables. (line 442)
* HISTFILE: Bash Variables. (line 460)
* HISTFILESIZE: Bash Variables. (line 466)
* HISTIGNORE: Bash Variables. (line 477)
* FUNCNAME: Bash Variables. (line 348)
* FUNCNEST: Bash Variables. (line 365)
* GLOBIGNORE: Bash Variables. (line 370)
* GLOBSORT: Bash Variables. (line 377)
* GROUPS: Bash Variables. (line 415)
* histchars: Bash Variables. (line 421)
* HISTCMD: Bash Variables. (line 437)
* HISTCONTROL: Bash Variables. (line 443)
* HISTFILE: Bash Variables. (line 461)
* HISTFILESIZE: Bash Variables. (line 467)
* HISTIGNORE: Bash Variables. (line 478)
* history-preserve-point: Readline Init File Syntax.
(line 234)
* history-size: Readline Init File Syntax.
(line 240)
* HISTSIZE: Bash Variables. (line 501)
* HISTTIMEFORMAT: Bash Variables. (line 508)
* HISTSIZE: Bash Variables. (line 502)
* HISTTIMEFORMAT: Bash Variables. (line 509)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 250)
* HOSTFILE: Bash Variables. (line 517)
* HOSTNAME: Bash Variables. (line 528)
* HOSTTYPE: Bash Variables. (line 531)
* HOSTFILE: Bash Variables. (line 518)
* HOSTNAME: Bash Variables. (line 529)
* HOSTTYPE: Bash Variables. (line 532)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 534)
* IGNOREEOF: Bash Variables. (line 535)
* input-meta: Readline Init File Syntax.
(line 258)
* INPUTRC: Bash Variables. (line 543)
* INSIDE_EMACS: Bash Variables. (line 547)
* INPUTRC: Bash Variables. (line 544)
* INSIDE_EMACS: Bash Variables. (line 548)
* isearch-terminators: Readline Init File Syntax.
(line 269)
* keymap: Readline Init File Syntax.
(line 276)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 553)
* LC_ALL: Bash Variables. (line 557)
* LC_COLLATE: Bash Variables. (line 561)
* LC_CTYPE: Bash Variables. (line 568)
* LANG <1>: Bash Variables. (line 554)
* LC_ALL: Bash Variables. (line 558)
* LC_COLLATE: Bash Variables. (line 562)
* LC_CTYPE: Bash Variables. (line 569)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
* LC_MESSAGES <1>: Bash Variables. (line 573)
* LC_NUMERIC: Bash Variables. (line 577)
* LC_TIME: Bash Variables. (line 581)
* LINENO: Bash Variables. (line 585)
* LINES: Bash Variables. (line 592)
* MACHTYPE: Bash Variables. (line 598)
* LC_MESSAGES <1>: Bash Variables. (line 574)
* LC_NUMERIC: Bash Variables. (line 578)
* LC_TIME: Bash Variables. (line 582)
* LINENO: Bash Variables. (line 586)
* LINES: Bash Variables. (line 593)
* MACHTYPE: Bash Variables. (line 599)
* MAIL: Bourne Shell Variables.
(line 24)
* MAILCHECK: Bash Variables. (line 602)
* MAILCHECK: Bash Variables. (line 603)
* MAILPATH: Bourne Shell Variables.
(line 29)
* MAPFILE: Bash Variables. (line 610)
* MAPFILE: Bash Variables. (line 611)
* mark-modified-lines: Readline Init File Syntax.
(line 306)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -13090,46 +13093,46 @@ D.3 Parameter and Variable Index
(line 323)
* meta-flag: Readline Init File Syntax.
(line 258)
* OLDPWD: Bash Variables. (line 614)
* OLDPWD: Bash Variables. (line 615)
* OPTARG: Bourne Shell Variables.
(line 36)
* OPTERR: Bash Variables. (line 617)
* OPTERR: Bash Variables. (line 618)
* OPTIND: Bourne Shell Variables.
(line 40)
* OSTYPE: Bash Variables. (line 622)
* OSTYPE: Bash Variables. (line 623)
* output-meta: Readline Init File Syntax.
(line 328)
* page-completions: Readline Init File Syntax.
(line 337)
* PATH: Bourne Shell Variables.
(line 44)
* PIPESTATUS: Bash Variables. (line 625)
* POSIXLY_CORRECT: Bash Variables. (line 635)
* PPID: Bash Variables. (line 645)
* PROMPT_COMMAND: Bash Variables. (line 649)
* PROMPT_DIRTRIM: Bash Variables. (line 655)
* PS0: Bash Variables. (line 661)
* PIPESTATUS: Bash Variables. (line 626)
* POSIXLY_CORRECT: Bash Variables. (line 636)
* PPID: Bash Variables. (line 646)
* PROMPT_COMMAND: Bash Variables. (line 650)
* PROMPT_DIRTRIM: Bash Variables. (line 656)
* PS0: Bash Variables. (line 662)
* PS1: Bourne Shell Variables.
(line 53)
* PS2: Bourne Shell Variables.
(line 58)
* PS3: Bash Variables. (line 666)
* PS4: Bash Variables. (line 671)
* PWD: Bash Variables. (line 679)
* RANDOM: Bash Variables. (line 682)
* READLINE_ARGUMENT: Bash Variables. (line 690)
* READLINE_LINE: Bash Variables. (line 694)
* READLINE_MARK: Bash Variables. (line 698)
* READLINE_POINT: Bash Variables. (line 704)
* REPLY: Bash Variables. (line 708)
* PS3: Bash Variables. (line 667)
* PS4: Bash Variables. (line 672)
* PWD: Bash Variables. (line 680)
* RANDOM: Bash Variables. (line 683)
* READLINE_ARGUMENT: Bash Variables. (line 691)
* READLINE_LINE: Bash Variables. (line 695)
* READLINE_MARK: Bash Variables. (line 699)
* READLINE_POINT: Bash Variables. (line 705)
* REPLY: Bash Variables. (line 709)
* revert-all-at-newline: Readline Init File Syntax.
(line 350)
* search-ignore-case: Readline Init File Syntax.
(line 357)
* SECONDS: Bash Variables. (line 712)
* SHELL: Bash Variables. (line 722)
* SHELLOPTS: Bash Variables. (line 727)
* SHLVL: Bash Variables. (line 737)
* SECONDS: Bash Variables. (line 713)
* SHELL: Bash Variables. (line 723)
* SHELLOPTS: Bash Variables. (line 728)
* SHLVL: Bash Variables. (line 738)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 362)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -13138,15 +13141,15 @@ D.3 Parameter and Variable Index
(line 377)
* skip-completed-text: Readline Init File Syntax.
(line 383)
* SRANDOM: Bash Variables. (line 742)
* SRANDOM: Bash Variables. (line 743)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
* TIMEFORMAT: Bash Variables. (line 751)
* TMOUT: Bash Variables. (line 790)
* TMPDIR: Bash Variables. (line 802)
* UID: Bash Variables. (line 806)
* TIMEFORMAT: Bash Variables. (line 752)
* TMOUT: Bash Variables. (line 791)
* TMPDIR: Bash Variables. (line 803)
* UID: Bash Variables. (line 807)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 396)
* vi-ins-mode-string: Readline Init File Syntax.
@@ -13576,103 +13579,103 @@ Node: Shell Expansions74043
Node: Brace Expansion76232
Node: Tilde Expansion79578
Node: Shell Parameter Expansion82533
Node: Command Substitution102293
Node: Arithmetic Expansion105822
Node: Process Substitution106836
Node: Word Splitting107944
Node: Filename Expansion110388
Node: Pattern Matching113612
Node: Quote Removal119335
Node: Redirections119639
Node: Executing Commands129902
Node: Simple Command Expansion130569
Node: Command Search and Execution132677
Node: Command Execution Environment135121
Node: Environment138569
Node: Exit Status140472
Node: Signals142530
Node: Shell Scripts147459
Node: Shell Builtin Commands150757
Node: Bourne Shell Builtins152868
Node: Bash Builtins179432
Node: Modifying Shell Behavior216356
Node: The Set Builtin216698
Node: The Shopt Builtin228686
Node: Special Builtins245738
Node: Shell Variables246727
Node: Bourne Shell Variables247161
Node: Bash Variables249669
Node: Bash Features288488
Node: Invoking Bash289502
Node: Bash Startup Files296086
Node: Interactive Shells301328
Node: What is an Interactive Shell?301736
Node: Is this Shell Interactive?302398
Node: Interactive Shell Behavior303222
Node: Bash Conditional Expressions306983
Node: Shell Arithmetic312194
Node: Aliases315523
Node: Arrays318657
Node: The Directory Stack325749
Node: Directory Stack Builtins326546
Node: Controlling the Prompt330991
Node: The Restricted Shell333876
Node: Bash POSIX Mode336758
Node: Shell Compatibility Mode354819
Node: Job Control363826
Node: Job Control Basics364283
Node: Job Control Builtins370561
Node: Job Control Variables377243
Node: Command Line Editing378474
Node: Introduction and Notation380177
Node: Readline Interaction382529
Node: Readline Bare Essentials383717
Node: Readline Movement Commands385525
Node: Readline Killing Commands386521
Node: Readline Arguments388544
Node: Searching389601
Node: Readline Init File391844
Node: Readline Init File Syntax393147
Node: Conditional Init Constructs419972
Node: Sample Init File424357
Node: Bindable Readline Commands427477
Node: Commands For Moving429015
Node: Commands For History431383
Node: Commands For Text436773
Node: Commands For Killing440898
Node: Numeric Arguments443686
Node: Commands For Completion444838
Node: Keyboard Macros450534
Node: Miscellaneous Commands451235
Node: Readline vi Mode457802
Node: Programmable Completion458779
Node: Programmable Completion Builtins467516
Node: A Programmable Completion Example479253
Node: Using History Interactively484598
Node: Bash History Facilities485279
Node: Bash History Builtins489014
Node: History Interaction495485
Node: Event Designators500435
Node: Word Designators502013
Node: Modifiers504317
Node: Installing Bash506254
Node: Basic Installation507370
Node: Compilers and Options511246
Node: Compiling For Multiple Architectures511996
Node: Installation Names513749
Node: Specifying the System Type515983
Node: Sharing Defaults516729
Node: Operation Controls517443
Node: Optional Features518462
Node: Reporting Bugs530842
Node: Major Differences From The Bourne Shell532199
Node: GNU Free Documentation License553619
Node: Indexes578796
Node: Builtin Index579247
Node: Reserved Word Index586345
Node: Variable Index588790
Node: Function Index606203
Node: Concept Index620198
Node: Command Substitution102341
Node: Arithmetic Expansion105870
Node: Process Substitution106884
Node: Word Splitting107992
Node: Filename Expansion110436
Node: Pattern Matching113660
Node: Quote Removal119383
Node: Redirections119687
Node: Executing Commands129950
Node: Simple Command Expansion130617
Node: Command Search and Execution132725
Node: Command Execution Environment135169
Node: Environment138617
Node: Exit Status140520
Node: Signals142578
Node: Shell Scripts147507
Node: Shell Builtin Commands150805
Node: Bourne Shell Builtins152916
Node: Bash Builtins179480
Node: Modifying Shell Behavior216404
Node: The Set Builtin216746
Node: The Shopt Builtin228734
Node: Special Builtins245786
Node: Shell Variables246775
Node: Bourne Shell Variables247209
Node: Bash Variables249717
Node: Bash Features288622
Node: Invoking Bash289636
Node: Bash Startup Files296220
Node: Interactive Shells301462
Node: What is an Interactive Shell?301870
Node: Is this Shell Interactive?302532
Node: Interactive Shell Behavior303356
Node: Bash Conditional Expressions307117
Node: Shell Arithmetic312328
Node: Aliases315657
Node: Arrays318791
Node: The Directory Stack325883
Node: Directory Stack Builtins326680
Node: Controlling the Prompt331125
Node: The Restricted Shell334010
Node: Bash POSIX Mode336892
Node: Shell Compatibility Mode354953
Node: Job Control363960
Node: Job Control Basics364417
Node: Job Control Builtins370695
Node: Job Control Variables377377
Node: Command Line Editing378608
Node: Introduction and Notation380311
Node: Readline Interaction382663
Node: Readline Bare Essentials383851
Node: Readline Movement Commands385659
Node: Readline Killing Commands386655
Node: Readline Arguments388678
Node: Searching389735
Node: Readline Init File391978
Node: Readline Init File Syntax393281
Node: Conditional Init Constructs420106
Node: Sample Init File424491
Node: Bindable Readline Commands427611
Node: Commands For Moving429149
Node: Commands For History431517
Node: Commands For Text436907
Node: Commands For Killing441032
Node: Numeric Arguments443820
Node: Commands For Completion444972
Node: Keyboard Macros450668
Node: Miscellaneous Commands451369
Node: Readline vi Mode457936
Node: Programmable Completion458913
Node: Programmable Completion Builtins467650
Node: A Programmable Completion Example479387
Node: Using History Interactively484732
Node: Bash History Facilities485413
Node: Bash History Builtins489148
Node: History Interaction495619
Node: Event Designators500569
Node: Word Designators502147
Node: Modifiers504539
Node: Installing Bash506476
Node: Basic Installation507592
Node: Compilers and Options511468
Node: Compiling For Multiple Architectures512218
Node: Installation Names513971
Node: Specifying the System Type516205
Node: Sharing Defaults516951
Node: Operation Controls517665
Node: Optional Features518684
Node: Reporting Bugs531064
Node: Major Differences From The Bourne Shell532421
Node: GNU Free Documentation License553841
Node: Indexes579018
Node: Builtin Index579469
Node: Reserved Word Index586567
Node: Variable Index589012
Node: Function Index606425
Node: Concept Index620420

End Tag Table
+220 -217
View File
@@ -2143,13 +2143,12 @@ omitted, the operator tests only for existence.
${PARAMETER//PATTERN/STRING}
${PARAMETER/#PATTERN/STRING}
${PARAMETER/%PATTERN/STRING}
The PATTERN is expanded to produce a pattern just as in filename
expansion and matched against the expanded value of PARAMETER
according to the rules described below (*note Pattern Matching::).
The longest match of PATTERN in the expanded value is replaced with
STRING. STRING undergoes tilde expansion, parameter and variable
expansion, arithmetic expansion, command and process substitution,
and quote removal.
The PATTERN is expanded to produce a pattern and matched against
the expanded value of PARAMETER as described below (*note Pattern
Matching::). The longest match of PATTERN in the expanded value is
replaced with STRING. STRING undergoes tilde expansion, parameter
and variable expansion, arithmetic expansion, command and process
substitution, and quote removal.
In the first form above, only the first match is replaced. If
there are two slashes separating PARAMETER and PATTERN (the second
@@ -2233,19 +2232,21 @@ omitted, the operator tests only for existence.
${PARAMETER,PATTERN}
${PARAMETER,,PATTERN}
This expansion modifies the case of alphabetic characters in
PARAMETER. The PATTERN is expanded to produce a pattern just as in
filename expansion. Each character in the expanded value of
PARAMETER is tested against PATTERN, and, if it matches the
PARAMETER. First, the PATTERN is expanded to produce a pattern as
described below in *note Pattern Matching::.
Bash then examines characters in the expanded value of PARAMETER
against PATTERN as described below. If a character matches the
pattern, its case is converted. The pattern should not attempt to
match more than one character.
The ^ operator converts lowercase letters matching PATTERN to
uppercase; the , operator converts matching uppercase letters to
lowercase. The ^^ and ,, expansions convert each matched
character in the expanded value; the ^ and , expansions match
and convert only the first character in the expanded value. If
PATTERN is omitted, it is treated like a ?, which matches every
character.
Using ^ converts lowercase letters matching PATTERN to uppercase;
, converts matching uppercase letters to lowercase. The ^ and
, variants examine the first character in the expanded value and
convert its case if it matches PATTERN; the ^^ and ,, variants
examine all characters in the expanded value and convert each one
that matches PATTERN. If PATTERN is omitted, it is treated like a
?, which matches every character.
If PARAMETER is @ or *, the case modification operation is
applied to each positional parameter in turn, and the expansion is
@@ -5634,8 +5635,9 @@ Variables::).
command (*note The Shopt Builtin::). The options appearing in
BASHOPTS are those reported as on by shopt. If this variable
is in the environment when Bash starts up, the shell enables each
option in the list before reading any startup files. This variable
is readonly.
option in the list before reading any startup files. If this
variable is exported, child shells will enable each option in the
list. This variable is readonly.
BASHPID
Expands to the process ID of the current Bash process. This
@@ -11116,8 +11118,9 @@ expansion uses the entire event. A : separates the event
specification from the word designator. It may be omitted if the word
designator begins with a ^, $, *, -, or %. Words are numbered
from the beginning of the line, with the first word being denoted by 0
(zero). Words are inserted into the current line separated by single
spaces.
(zero). That first word is usually the command word, and the arguments
begin with the second word. Words are inserted into the current line
separated by single spaces.
For example,
@@ -11126,7 +11129,7 @@ spaces.
preceding command is repeated in toto.
!!:$
designates the last argument of the preceding command. This may be
designates the last word of the preceding command. This may be
shortened to !$.
!fi:2
@@ -12939,27 +12942,27 @@ D.3 Parameter and Variable Index
* auto_resume: Job Control Variables.
(line 6)
* BASH: Bash Variables. (line 24)
* BASH_ALIASES: Bash Variables. (line 43)
* BASH_ARGC: Bash Variables. (line 52)
* BASH_ARGV: Bash Variables. (line 66)
* BASH_ARGV0: Bash Variables. (line 79)
* BASH_CMDS: Bash Variables. (line 87)
* BASH_COMMAND: Bash Variables. (line 96)
* BASH_COMPAT: Bash Variables. (line 103)
* BASH_ENV: Bash Variables. (line 119)
* BASH_EXECUTION_STRING: Bash Variables. (line 125)
* BASH_LINENO: Bash Variables. (line 128)
* BASH_LOADABLES_PATH: Bash Variables. (line 138)
* BASH_MONOSECONDS: Bash Variables. (line 142)
* BASH_REMATCH: Bash Variables. (line 149)
* BASH_SOURCE: Bash Variables. (line 157)
* BASH_SUBSHELL: Bash Variables. (line 165)
* BASH_TRAPSIG: Bash Variables. (line 171)
* BASH_VERSINFO: Bash Variables. (line 177)
* BASH_VERSION: Bash Variables. (line 200)
* BASH_XTRACEFD: Bash Variables. (line 204)
* BASH_ALIASES: Bash Variables. (line 44)
* BASH_ARGC: Bash Variables. (line 53)
* BASH_ARGV: Bash Variables. (line 67)
* BASH_ARGV0: Bash Variables. (line 80)
* BASH_CMDS: Bash Variables. (line 88)
* BASH_COMMAND: Bash Variables. (line 97)
* BASH_COMPAT: Bash Variables. (line 104)
* BASH_ENV: Bash Variables. (line 120)
* BASH_EXECUTION_STRING: Bash Variables. (line 126)
* BASH_LINENO: Bash Variables. (line 129)
* BASH_LOADABLES_PATH: Bash Variables. (line 139)
* BASH_MONOSECONDS: Bash Variables. (line 143)
* BASH_REMATCH: Bash Variables. (line 150)
* BASH_SOURCE: Bash Variables. (line 158)
* BASH_SUBSHELL: Bash Variables. (line 166)
* BASH_TRAPSIG: Bash Variables. (line 172)
* BASH_VERSINFO: Bash Variables. (line 178)
* BASH_VERSION: Bash Variables. (line 201)
* BASH_XTRACEFD: Bash Variables. (line 205)
* BASHOPTS: Bash Variables. (line 27)
* BASHPID: Bash Variables. (line 36)
* BASHPID: Bash Variables. (line 37)
* bell-style: Readline Init File Syntax.
(line 64)
* bind-tty-special-chars: Readline Init File Syntax.
@@ -12968,21 +12971,21 @@ D.3 Parameter and Variable Index
(line 79)
* CDPATH: Bourne Shell Variables.
(line 9)
* CHILD_MAX: Bash Variables. (line 216)
* CHILD_MAX: Bash Variables. (line 217)
* colored-completion-prefix: Readline Init File Syntax.
(line 84)
* colored-stats: Readline Init File Syntax.
(line 94)
* COLUMNS: Bash Variables. (line 223)
* COLUMNS: Bash Variables. (line 224)
* comment-begin: Readline Init File Syntax.
(line 100)
* COMP_CWORD: Bash Variables. (line 229)
* COMP_KEY: Bash Variables. (line 235)
* COMP_LINE: Bash Variables. (line 241)
* COMP_POINT: Bash Variables. (line 246)
* COMP_TYPE: Bash Variables. (line 254)
* COMP_WORDBREAKS: Bash Variables. (line 264)
* COMP_WORDS: Bash Variables. (line 270)
* COMP_CWORD: Bash Variables. (line 230)
* COMP_KEY: Bash Variables. (line 236)
* COMP_LINE: Bash Variables. (line 242)
* COMP_POINT: Bash Variables. (line 247)
* COMP_TYPE: Bash Variables. (line 255)
* COMP_WORDBREAKS: Bash Variables. (line 265)
* COMP_WORDS: Bash Variables. (line 271)
* completion-display-width: Readline Init File Syntax.
(line 104)
* completion-ignore-case: Readline Init File Syntax.
@@ -12993,18 +12996,18 @@ D.3 Parameter and Variable Index
(line 122)
* completion-query-items: Readline Init File Syntax.
(line 131)
* COMPREPLY: Bash Variables. (line 277)
* COMPREPLY: Bash Variables. (line 278)
* convert-meta: Readline Init File Syntax.
(line 142)
* COPROC: Bash Variables. (line 283)
* DIRSTACK: Bash Variables. (line 287)
* COPROC: Bash Variables. (line 284)
* DIRSTACK: Bash Variables. (line 288)
* disable-completion: Readline Init File Syntax.
(line 154)
* echo-control-characters: Readline Init File Syntax.
(line 159)
* editing-mode: Readline Init File Syntax.
(line 164)
* EMACS: Bash Variables. (line 297)
* EMACS: Bash Variables. (line 298)
* emacs-mode-string: Readline Init File Syntax.
(line 170)
* enable-active-region The: Readline Init File Syntax.
@@ -13015,72 +13018,72 @@ D.3 Parameter and Variable Index
(line 202)
* enable-meta-key: Readline Init File Syntax.
(line 207)
* ENV: Bash Variables. (line 302)
* EPOCHREALTIME: Bash Variables. (line 307)
* EPOCHSECONDS: Bash Variables. (line 315)
* EUID: Bash Variables. (line 322)
* EXECIGNORE: Bash Variables. (line 326)
* ENV: Bash Variables. (line 303)
* EPOCHREALTIME: Bash Variables. (line 308)
* EPOCHSECONDS: Bash Variables. (line 316)
* EUID: Bash Variables. (line 323)
* EXECIGNORE: Bash Variables. (line 327)
* expand-tilde: Readline Init File Syntax.
(line 217)
* FCEDIT: Bash Variables. (line 338)
* FIGNORE: Bash Variables. (line 341)
* FCEDIT: Bash Variables. (line 339)
* FIGNORE: Bash Variables. (line 342)
* force-meta-prefix: Readline Init File Syntax.
(line 221)
* FUNCNAME: Bash Variables. (line 347)
* FUNCNEST: Bash Variables. (line 364)
* GLOBIGNORE: Bash Variables. (line 369)
* GLOBSORT: Bash Variables. (line 376)
* GROUPS: Bash Variables. (line 414)
* histchars: Bash Variables. (line 420)
* HISTCMD: Bash Variables. (line 436)
* HISTCONTROL: Bash Variables. (line 442)
* HISTFILE: Bash Variables. (line 460)
* HISTFILESIZE: Bash Variables. (line 466)
* HISTIGNORE: Bash Variables. (line 477)
* FUNCNAME: Bash Variables. (line 348)
* FUNCNEST: Bash Variables. (line 365)
* GLOBIGNORE: Bash Variables. (line 370)
* GLOBSORT: Bash Variables. (line 377)
* GROUPS: Bash Variables. (line 415)
* histchars: Bash Variables. (line 421)
* HISTCMD: Bash Variables. (line 437)
* HISTCONTROL: Bash Variables. (line 443)
* HISTFILE: Bash Variables. (line 461)
* HISTFILESIZE: Bash Variables. (line 467)
* HISTIGNORE: Bash Variables. (line 478)
* history-preserve-point: Readline Init File Syntax.
(line 234)
* history-size: Readline Init File Syntax.
(line 240)
* HISTSIZE: Bash Variables. (line 501)
* HISTTIMEFORMAT: Bash Variables. (line 508)
* HISTSIZE: Bash Variables. (line 502)
* HISTTIMEFORMAT: Bash Variables. (line 509)
* HOME: Bourne Shell Variables.
(line 13)
* horizontal-scroll-mode: Readline Init File Syntax.
(line 250)
* HOSTFILE: Bash Variables. (line 517)
* HOSTNAME: Bash Variables. (line 528)
* HOSTTYPE: Bash Variables. (line 531)
* HOSTFILE: Bash Variables. (line 518)
* HOSTNAME: Bash Variables. (line 529)
* HOSTTYPE: Bash Variables. (line 532)
* IFS: Bourne Shell Variables.
(line 18)
* IGNOREEOF: Bash Variables. (line 534)
* IGNOREEOF: Bash Variables. (line 535)
* input-meta: Readline Init File Syntax.
(line 258)
* INPUTRC: Bash Variables. (line 543)
* INSIDE_EMACS: Bash Variables. (line 547)
* INPUTRC: Bash Variables. (line 544)
* INSIDE_EMACS: Bash Variables. (line 548)
* isearch-terminators: Readline Init File Syntax.
(line 269)
* keymap: Readline Init File Syntax.
(line 276)
* LANG: Creating Internationalized Scripts.
(line 51)
* LANG <1>: Bash Variables. (line 553)
* LC_ALL: Bash Variables. (line 557)
* LC_COLLATE: Bash Variables. (line 561)
* LC_CTYPE: Bash Variables. (line 568)
* LANG <1>: Bash Variables. (line 554)
* LC_ALL: Bash Variables. (line 558)
* LC_COLLATE: Bash Variables. (line 562)
* LC_CTYPE: Bash Variables. (line 569)
* LC_MESSAGES: Creating Internationalized Scripts.
(line 51)
* LC_MESSAGES <1>: Bash Variables. (line 573)
* LC_NUMERIC: Bash Variables. (line 577)
* LC_TIME: Bash Variables. (line 581)
* LINENO: Bash Variables. (line 585)
* LINES: Bash Variables. (line 592)
* MACHTYPE: Bash Variables. (line 598)
* LC_MESSAGES <1>: Bash Variables. (line 574)
* LC_NUMERIC: Bash Variables. (line 578)
* LC_TIME: Bash Variables. (line 582)
* LINENO: Bash Variables. (line 586)
* LINES: Bash Variables. (line 593)
* MACHTYPE: Bash Variables. (line 599)
* MAIL: Bourne Shell Variables.
(line 24)
* MAILCHECK: Bash Variables. (line 602)
* MAILCHECK: Bash Variables. (line 603)
* MAILPATH: Bourne Shell Variables.
(line 29)
* MAPFILE: Bash Variables. (line 610)
* MAPFILE: Bash Variables. (line 611)
* mark-modified-lines: Readline Init File Syntax.
(line 306)
* mark-symlinked-directories: Readline Init File Syntax.
@@ -13091,46 +13094,46 @@ D.3 Parameter and Variable Index
(line 323)
* meta-flag: Readline Init File Syntax.
(line 258)
* OLDPWD: Bash Variables. (line 614)
* OLDPWD: Bash Variables. (line 615)
* OPTARG: Bourne Shell Variables.
(line 36)
* OPTERR: Bash Variables. (line 617)
* OPTERR: Bash Variables. (line 618)
* OPTIND: Bourne Shell Variables.
(line 40)
* OSTYPE: Bash Variables. (line 622)
* OSTYPE: Bash Variables. (line 623)
* output-meta: Readline Init File Syntax.
(line 328)
* page-completions: Readline Init File Syntax.
(line 337)
* PATH: Bourne Shell Variables.
(line 44)
* PIPESTATUS: Bash Variables. (line 625)
* POSIXLY_CORRECT: Bash Variables. (line 635)
* PPID: Bash Variables. (line 645)
* PROMPT_COMMAND: Bash Variables. (line 649)
* PROMPT_DIRTRIM: Bash Variables. (line 655)
* PS0: Bash Variables. (line 661)
* PIPESTATUS: Bash Variables. (line 626)
* POSIXLY_CORRECT: Bash Variables. (line 636)
* PPID: Bash Variables. (line 646)
* PROMPT_COMMAND: Bash Variables. (line 650)
* PROMPT_DIRTRIM: Bash Variables. (line 656)
* PS0: Bash Variables. (line 662)
* PS1: Bourne Shell Variables.
(line 53)
* PS2: Bourne Shell Variables.
(line 58)
* PS3: Bash Variables. (line 666)
* PS4: Bash Variables. (line 671)
* PWD: Bash Variables. (line 679)
* RANDOM: Bash Variables. (line 682)
* READLINE_ARGUMENT: Bash Variables. (line 690)
* READLINE_LINE: Bash Variables. (line 694)
* READLINE_MARK: Bash Variables. (line 698)
* READLINE_POINT: Bash Variables. (line 704)
* REPLY: Bash Variables. (line 708)
* PS3: Bash Variables. (line 667)
* PS4: Bash Variables. (line 672)
* PWD: Bash Variables. (line 680)
* RANDOM: Bash Variables. (line 683)
* READLINE_ARGUMENT: Bash Variables. (line 691)
* READLINE_LINE: Bash Variables. (line 695)
* READLINE_MARK: Bash Variables. (line 699)
* READLINE_POINT: Bash Variables. (line 705)
* REPLY: Bash Variables. (line 709)
* revert-all-at-newline: Readline Init File Syntax.
(line 350)
* search-ignore-case: Readline Init File Syntax.
(line 357)
* SECONDS: Bash Variables. (line 712)
* SHELL: Bash Variables. (line 722)
* SHELLOPTS: Bash Variables. (line 727)
* SHLVL: Bash Variables. (line 737)
* SECONDS: Bash Variables. (line 713)
* SHELL: Bash Variables. (line 723)
* SHELLOPTS: Bash Variables. (line 728)
* SHLVL: Bash Variables. (line 738)
* show-all-if-ambiguous: Readline Init File Syntax.
(line 362)
* show-all-if-unmodified: Readline Init File Syntax.
@@ -13139,15 +13142,15 @@ D.3 Parameter and Variable Index
(line 377)
* skip-completed-text: Readline Init File Syntax.
(line 383)
* SRANDOM: Bash Variables. (line 742)
* SRANDOM: Bash Variables. (line 743)
* TEXTDOMAIN: Creating Internationalized Scripts.
(line 51)
* TEXTDOMAINDIR: Creating Internationalized Scripts.
(line 51)
* TIMEFORMAT: Bash Variables. (line 751)
* TMOUT: Bash Variables. (line 790)
* TMPDIR: Bash Variables. (line 802)
* UID: Bash Variables. (line 806)
* TIMEFORMAT: Bash Variables. (line 752)
* TMOUT: Bash Variables. (line 791)
* TMPDIR: Bash Variables. (line 803)
* UID: Bash Variables. (line 807)
* vi-cmd-mode-string: Readline Init File Syntax.
(line 396)
* vi-ins-mode-string: Readline Init File Syntax.
@@ -13577,103 +13580,103 @@ Node: Shell Expansions74139
Node: Brace Expansion76331
Node: Tilde Expansion79680
Node: Shell Parameter Expansion82638
Node: Command Substitution102401
Node: Arithmetic Expansion105933
Node: Process Substitution106950
Node: Word Splitting108061
Node: Filename Expansion110508
Node: Pattern Matching113735
Node: Quote Removal119461
Node: Redirections119768
Node: Executing Commands130034
Node: Simple Command Expansion130704
Node: Command Search and Execution132815
Node: Command Execution Environment135262
Node: Environment138713
Node: Exit Status140619
Node: Signals142680
Node: Shell Scripts147612
Node: Shell Builtin Commands150913
Node: Bourne Shell Builtins153027
Node: Bash Builtins179594
Node: Modifying Shell Behavior216521
Node: The Set Builtin216866
Node: The Shopt Builtin228857
Node: Special Builtins245912
Node: Shell Variables246904
Node: Bourne Shell Variables247341
Node: Bash Variables249852
Node: Bash Features288674
Node: Invoking Bash289691
Node: Bash Startup Files296278
Node: Interactive Shells301523
Node: What is an Interactive Shell?301934
Node: Is this Shell Interactive?302599
Node: Interactive Shell Behavior303426
Node: Bash Conditional Expressions307190
Node: Shell Arithmetic312404
Node: Aliases315736
Node: Arrays318873
Node: The Directory Stack325968
Node: Directory Stack Builtins326768
Node: Controlling the Prompt331216
Node: The Restricted Shell334104
Node: Bash POSIX Mode336989
Node: Shell Compatibility Mode355053
Node: Job Control364063
Node: Job Control Basics364523
Node: Job Control Builtins370804
Node: Job Control Variables377489
Node: Command Line Editing378723
Node: Introduction and Notation380429
Node: Readline Interaction382784
Node: Readline Bare Essentials383975
Node: Readline Movement Commands385786
Node: Readline Killing Commands386785
Node: Readline Arguments388811
Node: Searching389871
Node: Readline Init File392117
Node: Readline Init File Syntax393423
Node: Conditional Init Constructs420251
Node: Sample Init File424639
Node: Bindable Readline Commands427762
Node: Commands For Moving429303
Node: Commands For History431674
Node: Commands For Text437067
Node: Commands For Killing441195
Node: Numeric Arguments443986
Node: Commands For Completion445141
Node: Keyboard Macros450840
Node: Miscellaneous Commands451544
Node: Readline vi Mode458114
Node: Programmable Completion459094
Node: Programmable Completion Builtins467834
Node: A Programmable Completion Example479574
Node: Using History Interactively484922
Node: Bash History Facilities485606
Node: Bash History Builtins489344
Node: History Interaction495818
Node: Event Designators500771
Node: Word Designators502352
Node: Modifiers504659
Node: Installing Bash506599
Node: Basic Installation507718
Node: Compilers and Options511597
Node: Compiling For Multiple Architectures512350
Node: Installation Names514106
Node: Specifying the System Type516343
Node: Sharing Defaults517092
Node: Operation Controls517809
Node: Optional Features518831
Node: Reporting Bugs531214
Node: Major Differences From The Bourne Shell532574
Node: GNU Free Documentation License553997
Node: Indexes579177
Node: Builtin Index579631
Node: Reserved Word Index586732
Node: Variable Index589180
Node: Function Index606596
Node: Concept Index620594
Node: Command Substitution102449
Node: Arithmetic Expansion105981
Node: Process Substitution106998
Node: Word Splitting108109
Node: Filename Expansion110556
Node: Pattern Matching113783
Node: Quote Removal119509
Node: Redirections119816
Node: Executing Commands130082
Node: Simple Command Expansion130752
Node: Command Search and Execution132863
Node: Command Execution Environment135310
Node: Environment138761
Node: Exit Status140667
Node: Signals142728
Node: Shell Scripts147660
Node: Shell Builtin Commands150961
Node: Bourne Shell Builtins153075
Node: Bash Builtins179642
Node: Modifying Shell Behavior216569
Node: The Set Builtin216914
Node: The Shopt Builtin228905
Node: Special Builtins245960
Node: Shell Variables246952
Node: Bourne Shell Variables247389
Node: Bash Variables249900
Node: Bash Features288808
Node: Invoking Bash289825
Node: Bash Startup Files296412
Node: Interactive Shells301657
Node: What is an Interactive Shell?302068
Node: Is this Shell Interactive?302733
Node: Interactive Shell Behavior303560
Node: Bash Conditional Expressions307324
Node: Shell Arithmetic312538
Node: Aliases315870
Node: Arrays319007
Node: The Directory Stack326102
Node: Directory Stack Builtins326902
Node: Controlling the Prompt331350
Node: The Restricted Shell334238
Node: Bash POSIX Mode337123
Node: Shell Compatibility Mode355187
Node: Job Control364197
Node: Job Control Basics364657
Node: Job Control Builtins370938
Node: Job Control Variables377623
Node: Command Line Editing378857
Node: Introduction and Notation380563
Node: Readline Interaction382918
Node: Readline Bare Essentials384109
Node: Readline Movement Commands385920
Node: Readline Killing Commands386919
Node: Readline Arguments388945
Node: Searching390005
Node: Readline Init File392251
Node: Readline Init File Syntax393557
Node: Conditional Init Constructs420385
Node: Sample Init File424773
Node: Bindable Readline Commands427896
Node: Commands For Moving429437
Node: Commands For History431808
Node: Commands For Text437201
Node: Commands For Killing441329
Node: Numeric Arguments444120
Node: Commands For Completion445275
Node: Keyboard Macros450974
Node: Miscellaneous Commands451678
Node: Readline vi Mode458248
Node: Programmable Completion459228
Node: Programmable Completion Builtins467968
Node: A Programmable Completion Example479708
Node: Using History Interactively485056
Node: Bash History Facilities485740
Node: Bash History Builtins489478
Node: History Interaction495952
Node: Event Designators500905
Node: Word Designators502486
Node: Modifiers504881
Node: Installing Bash506821
Node: Basic Installation507940
Node: Compilers and Options511819
Node: Compiling For Multiple Architectures512572
Node: Installation Names514328
Node: Specifying the System Type516565
Node: Sharing Defaults517314
Node: Operation Controls518031
Node: Optional Features519053
Node: Reporting Bugs531436
Node: Major Differences From The Bourne Shell532796
Node: GNU Free Documentation License554219
Node: Indexes579399
Node: Builtin Index579853
Node: Reserved Word Index586954
Node: Variable Index589402
Node: Function Index606818
Node: Concept Index620816

End Tag Table
+23 -15
View File
@@ -2583,11 +2583,9 @@ array in turn, and the expansion is the resultant list.
@itemx $@{@var{parameter}//@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/#@var{pattern}/@var{string}@}
@itemx $@{@var{parameter}/%@var{pattern}/@var{string}@}
The @var{pattern} is expanded to produce a pattern just as in
filename expansion and matched
against the expanded value of @var{parameter}
according to the rules
described below (@pxref{Pattern Matching}).
The @var{pattern} is expanded to produce a pattern
and matched against the expanded value of @var{parameter}
as described below (@pxref{Pattern Matching}).
The longest match of @var{pattern}
in the expanded value is replaced with @var{string}.
@var{string} undergoes tilde expansion, parameter and variable expansion,
@@ -2693,18 +2691,28 @@ array in turn, and the expansion is the resultant list.
@itemx $@{@var{parameter},@var{pattern}@}
@itemx $@{@var{parameter},,@var{pattern}@}
This expansion modifies the case of alphabetic characters in @var{parameter}.
The @var{pattern} is expanded to produce a pattern just as in
filename expansion.
Each character in the expanded value of @var{parameter} is tested against
@var{pattern}, and, if it matches the pattern, its case is converted.
First, the @var{pattern} is expanded to produce a pattern
as described below in @ref{Pattern Matching}.
@code{Bash}
then examines characters in the expanded value of @var{parameter}
against @var{pattern} as described below.
If a character matches the pattern, its case is converted.
The pattern should not attempt to match more than one character.
The @samp{^} operator converts lowercase letters matching @var{pattern}
to uppercase; the @samp{,} operator converts matching uppercase letters
to lowercase.
The @samp{^^} and @samp{,,} expansions convert each matched character in the
expanded value; the @samp{^} and @samp{,} expansions match and convert only
the first character in the expanded value.
Using
@samp{^}
converts lowercase letters matching @var{pattern} to uppercase;
@samp{,}
converts matching uppercase letters to lowercase.
The
@samp{^} and @samp{,} variants
examine the first character in the expanded value
and convert its case if it matches @var{pattern};
the
@samp{^^} and @samp{,,} variants
examine all characters in the expanded value
and convert each one that matches @var{pattern}.
If @var{pattern} is omitted, it is treated like a @samp{?}, which matches
every character.
+1 -2
View File
@@ -642,7 +642,7 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
though the shell normally searches for builtins before files.
If --nn is supplied, each _n_a_m_e is disabled; otherwise, _n_a_m_es are
enabled. For example, to use the tteesstt binary found usin g PPAATTHH
enabled. For example, to use the tteesstt binary found using PPAATTHH
instead of the shell builtin version, run
If no _n_a_m_e arguments are supplied, or if the --pp option is sup-
@@ -1618,7 +1618,6 @@ BBAASSHH BBUUIILLTTIINN CCOOMMMMAANNDDSS
ccoommppaatt4422
ccoommppaatt4433
ccoommppaatt4444
ccoommppaatt5500
These control aspects of the shell's compatibility mode
(see SSHHEELLLL CCOOMMPPAATTIIBBIILLIITTYY MMOODDEE in _b_a_s_h(1)).
ccoommpplleettee__ffuullllqquuoottee
+5 -1
View File
@@ -95,7 +95,11 @@ reader_loop (void)
{
/* Some kind of throw to top_level has occurred. */
case ERREXIT:
if (exit_immediately_on_error)
/* POSIX says to exit on error "as if by executing the
exit special built-in utility with no arguments," so we
don't reset any local contexts and keep the execution
context in a shell function if we were executing one. */
if (exit_immediately_on_error && posixly_correct == 0)
reset_local_contexts (); /* not in a function */
case FORCE_EOF:
case EXITPROG:
+45 -20
View File
@@ -1489,7 +1489,7 @@ rl_redisplay (void)
but the buffer position needs to be adjusted to account
for invisible characters. */
if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line)
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);;
_rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset);
}
/* Now we move the cursor to where it needs to be. First, make
@@ -1502,28 +1502,53 @@ rl_redisplay (void)
invisible character in the prompt string. */
/* XXX - why not use local_prompt_len? */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == prompt_last_screen_line && wrap_offset > 0 &&
_rl_last_c_pos > 0 && local_prompt &&
_rl_last_c_pos < PROMPT_ENDING_INDEX)
if (cursor_linenum == prompt_last_screen_line)
{
int pmt_offset;
int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0;
int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset;
int cursor_bufpos;
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
/* cursor_bufpos is where the portion of the prompt that appears
on the current screen line begins in the buffer. It is a
buffer position, an index into curline
(local_prompt + pmt_offset) */
cursor_bufpos = pmt_offset;
if (mb_cur_max == 1 || rl_byte_oriented)
cursor_bufpos += _rl_last_c_pos;
else
cursor_bufpos += _rl_last_c_pos + curline_invchars;
/* If the number of characters in local_prompt is greater than
the screen width, the prompt wraps. We only want to print the
portion after the line wrap. */
pmt_offset = local_prompt_newlines[cursor_linenum];
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
else
_rl_output_some_chars (local_prompt, nleft);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark;
else
_rl_last_c_pos = nleft + modmark; /* buffer position */
if (local_prompt && local_prompt_invis_chars[cursor_linenum] &&
_rl_last_c_pos > 0 &&
cursor_bufpos <= prompt_last_invisible)
{
_rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
/* If the number of characters in local_prompt is greater
than the screen width, the prompt wraps. We only want to
print the portion after the line wrap. */
/* Make sure we set _rl_last_c_pos based on the number of
characters we actually output, since we start at column 0. */
if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset)
_rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset);
else
{
_rl_output_some_chars (local_prompt, nleft);
pmt_offset = 0; /* force for calculation below */
}
if (mb_cur_max > 1 && rl_byte_oriented == 0)
/* Start width calculation where we started output. */
_rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark;
else
/* Index into invisible_line+inv_lbreaks[cursor_linenum],
since that's what we use in the call to
_rl_move_cursor_relative below. */
_rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */
}
}
/* Where on that line? And where does that line start
+3 -1
View File
@@ -504,6 +504,8 @@ It may be omitted if the word designator begins with a @samp{^}, @samp{$},
@samp{*}, @samp{-}, or @samp{%}.
Words are numbered from the beginning of the line,
with the first word being denoted by 0 (zero).
That first word is usually the command word, and the arguments begin
with the second word.
Words are inserted into the current line separated by single spaces.
@need 0.75
@@ -515,7 +517,7 @@ designates the preceding command.
When you type this, the preceding command is repeated in toto.
@item !!:$
designates the last argument of the preceding command.
designates the last word of the preceding command.
This may be shortened to @code{!$}.
@item !fi:2
+7 -1
View File
@@ -6510,7 +6510,13 @@ decode_prompt_string (char *string, int is_prompt)
case 'u':
if (current_user.user_name == 0)
get_current_user_info ();
temp = savestring (current_user.user_name);
if (promptvars || posixly_correct)
/* Make sure that expand_prompt_string is called with a
second argument of Q_DOUBLE_QUOTES if we use this
function here. */
temp = sh_backslash_quote_for_double_quotes (current_user.user_name, 0);
else
temp = savestring (current_user.user_name);
goto add_string;
case 'h':
+10 -1
View File
@@ -7494,9 +7494,16 @@ array_length_reference (const char *s)
failure. */
if ((var == 0 || invisible_p (var) || (assoc_p (var) == 0 && array_p (var) == 0)) && unbound_vars_is_error)
{
set_exit_status (EXECUTION_FAILURE);
#if 1
/* If the array isn't subscripted with `@' or `*', it's an error. */
if (ALL_ELEMENT_SUB (t[0]) == 0 || t[1] != RBRACK)
return (INTMAX_MIN); /* caller prints error */
#endif
/* If the variable is subscripted with `@' or `*', ksh93 allows it to
return 0. We treat it as a non-fatal error. */
c = *--t;
*t = '\0';
set_exit_status (EXECUTION_FAILURE);
err_unboundvar (s);
*t = c;
return (-1);
@@ -7521,6 +7528,8 @@ array_length_reference (const char *s)
return (var_isset (var) ? 1 : 0);
}
/* If an array variable is set, length expansions for unset elements
return 0. This is compatible with ksh93. */
if (assoc_p (var))
{
t[len - 1] = '\0';
+9 -9
View File
@@ -23,27 +23,27 @@ JOBaa bb cc ddCONTROL
NOTFOUND
./comsub2.tests: line 75: p: command not found
./comsub2.tests: line 75: p: command not found
expand_aliases off
expand_aliases off
expand_aliases off
expand_aliases off
outside:
./comsub2.tests: line 79: alias: p: not found
alias e='echo inside redefine'
expand_aliases off
expand_aliases off
1
expand_aliases on
expand_aliases on
2
expand_aliases on
expand_aliases on
outside:
./comsub2.tests: line 89: alias: p: not found
expand_aliases on
expand_aliases on
1
xx
expand_aliases on
expand_aliases on
2
xx
expand_aliases on
expand_aliases on
outside:
expand_aliases on
expand_aliases on
inside: 12 22 42
outside: 42 2
newlines
+1 -1
View File
@@ -79,7 +79,7 @@ this is ohio-state
1
0
testb
expand_aliases on
expand_aliases on
1
1
1
+6 -6
View File
@@ -182,10 +182,10 @@ no dotglob: .a .foo bar
? . .. .a .foo
*
bar
extglob off
extglob off
x
extglob off
extglob off
extglob off
extglob off
extglob off
extglob off
extglob off
extglob off
extglob off
extglob off
+47 -47
View File
@@ -126,51 +126,51 @@ shopt -u shift_verbose
shopt -u varredir_close
shopt -u xpg_echo
--
array_expand_once off
assoc_expand_once off
autocd off
bash_source_fullpath off
cdable_vars off
checkhash off
checkjobs off
checkwinsize off
compat31 off
compat32 off
compat40 off
compat41 off
compat42 off
compat43 off
compat44 off
direxpand off
dirspell off
dotglob off
execfail off
extdebug off
extglob off
failglob off
globstar off
gnu_errfmt off
histappend off
histreedit off
histverify off
huponexit off
inherit_errexit off
lastpipe off
lithist off
localvar_inherit off
localvar_unset off
login_shell off
mailwarn off
no_empty_cmd_completion off
nocaseglob off
nocasematch off
noexpand_translation off
nullglob off
progcomp_alias off
restricted_shell off
shift_verbose off
varredir_close off
xpg_echo off
array_expand_once off
assoc_expand_once off
autocd off
bash_source_fullpath off
cdable_vars off
checkhash off
checkjobs off
checkwinsize off
compat31 off
compat32 off
compat40 off
compat41 off
compat42 off
compat43 off
compat44 off
direxpand off
dirspell off
dotglob off
execfail off
extdebug off
extglob off
failglob off
globstar off
gnu_errfmt off
histappend off
histreedit off
histverify off
huponexit off
inherit_errexit off
lastpipe off
lithist off
localvar_inherit off
localvar_unset off
login_shell off
mailwarn off
no_empty_cmd_completion off
nocaseglob off
nocasematch off
noexpand_translation off
nullglob off
progcomp_alias off
restricted_shell off
shift_verbose off
varredir_close off
xpg_echo off
--
set +o allexport
set -o braceexpand
@@ -310,5 +310,5 @@ xtrace off
--
./shopt.tests: line 106: shopt: xyz1: invalid shell option name
./shopt.tests: line 107: shopt: xyz1: invalid option name
expand_aliases on
expand_aliases on
expand_aliases on
expand_aliases on
+3 -3
View File
@@ -270,9 +270,9 @@ declare -x v="x"
declare -x v="t"
declare -- v
declare -x v
ignoreeof on
ignoreeof off
ignoreeof on
ignoreeof on
ignoreeof off
ignoreeof on
10
local -
match 1