mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 17:09:50 +02:00
new noexpand_translations shopt option
This commit is contained in:
@@ -1675,3 +1675,19 @@ subst.c
|
||||
checking, so we don't interpret a closing quote as starting a new
|
||||
quoted string. Reported several times, most recently by
|
||||
Phi Debian <phi.debian@gmail.com> in 6/2021.
|
||||
|
||||
8/9
|
||||
---
|
||||
parse.y,subst.c
|
||||
- locale_expand: if the variable SINGLEQUOTE_TRANSLATIONS is non-zero,
|
||||
single-quote the translated result of $"..." (if it's different from
|
||||
the untranslated string)
|
||||
|
||||
builtins/shopt.def
|
||||
- noexpand_translation: new option to expose the value of
|
||||
SINGLEQUOTE_TRANSLATIONS
|
||||
|
||||
8/10
|
||||
----
|
||||
doc/{bash.1,bashref.texi}
|
||||
- noexpand_translation: add description of new option
|
||||
|
||||
@@ -94,6 +94,7 @@ extern int inherit_errexit;
|
||||
extern int localvar_inherit;
|
||||
extern int localvar_unset;
|
||||
extern int varassign_redir_autoclose;
|
||||
extern int singlequote_translations;
|
||||
|
||||
#if defined (EXTENDED_GLOB)
|
||||
extern int extended_glob;
|
||||
@@ -234,6 +235,7 @@ static struct {
|
||||
#endif
|
||||
{ "nocaseglob", &glob_ignore_case, (shopt_set_func_t *)NULL },
|
||||
{ "nocasematch", &match_ignore_case, (shopt_set_func_t *)NULL },
|
||||
{ "noexpand_translation", &singlequote_translations, (shopt_set_func_t *)NULL },
|
||||
{ "nullglob", &allow_null_glob_expansion, (shopt_set_func_t *)NULL },
|
||||
#if defined (PROGRAMMABLE_COMPLETION)
|
||||
{ "progcomp", &prog_completion_enabled, (shopt_set_func_t *)NULL },
|
||||
@@ -360,6 +362,7 @@ reset_shopt_options ()
|
||||
print_shift_error = 0;
|
||||
source_uses_path = promptvars = 1;
|
||||
varassign_redir_autoclose = 0;
|
||||
singlequote_translations = 0;
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
check_jobs_at_exit = 0;
|
||||
|
||||
+2448
-2437
File diff suppressed because it is too large
Load Diff
+21
-5
@@ -5,12 +5,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet.ramey@case.edu
|
||||
.\"
|
||||
.\" Last Change: Fri Aug 6 14:30:46 EDT 2021
|
||||
.\" Last Change: Tue Aug 10 11:06:20 EDT 2021
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2021 August 6" "GNU Bash 5.1"
|
||||
.TH BASH 1 "2021 August 10" "GNU Bash 5.1"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -1221,10 +1221,19 @@ The \fIgettext\fP infrastructure performs the lookup and
|
||||
translation, using the \fBLC_MESSAGES\fP, \fBTEXTDOMAINDIR\fP,
|
||||
and \fBTEXTDOMAIN\fP shell variables.
|
||||
If the current locale is \fBC\fP or \fBPOSIX\fP,
|
||||
or if there are no translations available,
|
||||
if there are no translations available,
|
||||
or if the string is not translated,
|
||||
the dollar sign is ignored.
|
||||
This is a form of double quoting, so the string remains double-quoted,
|
||||
whether or not it is translated and replaced.
|
||||
This is a form of double quoting, so the string remains double-quoted
|
||||
by default, whether or not it is translated and replaced.
|
||||
If the \fBnoexpand_translation\fP option is enabled
|
||||
using the \fBshopt\fP builtin,
|
||||
translated strings are single-quoted instead of double-quoted.
|
||||
See the description of
|
||||
.B shopt
|
||||
below under
|
||||
.SM
|
||||
.BR SHELL BUILTIN COMMANDS .
|
||||
.SH PARAMETERS
|
||||
A
|
||||
.I parameter
|
||||
@@ -10362,6 +10371,13 @@ while executing \fBcase\fP or \fB[[\fP conditional commands,
|
||||
when performing pattern substitution word expansions,
|
||||
or when filtering possible completions as part of programmable completion.
|
||||
.TP 8
|
||||
.B noexpand_translation
|
||||
If set,
|
||||
.B bash
|
||||
encloses the translated results of $"..." quoting in single quotes
|
||||
instead of double quotes.
|
||||
If the string is not translated, this has no effect.
|
||||
.TP 8
|
||||
.B nullglob
|
||||
If set,
|
||||
.B bash
|
||||
|
||||
+182
-169
@@ -2,9 +2,9 @@ This is bashref.info, produced by makeinfo version 6.7 from
|
||||
bashref.texi.
|
||||
|
||||
This text is a brief description of the features that are present in the
|
||||
Bash shell (version 5.1, 16 June 2021).
|
||||
Bash shell (version 5.1, 10 August 2021).
|
||||
|
||||
This is Edition 5.1, last updated 16 June 2021, of 'The GNU Bash
|
||||
This is Edition 5.1, last updated 10 August 2021, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.1.
|
||||
|
||||
Copyright (C) 1988-2021 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.1, 16 June 2021). The Bash home page is
|
||||
Bash shell (version 5.1, 10 August 2021). The Bash home page is
|
||||
<http://www.gnu.org/software/bash/>.
|
||||
|
||||
This is Edition 5.1, last updated 16 June 2021, of 'The GNU Bash
|
||||
This is Edition 5.1, last updated 10 August 2021, of 'The GNU Bash
|
||||
Reference Manual', for 'Bash', Version 5.1.
|
||||
|
||||
Bash contains features that appear in other popular shells, and some
|
||||
@@ -485,10 +485,12 @@ current locale. The 'gettext' infrastructure performs the lookup and
|
||||
translation, using the 'LC_MESSAGES', 'TEXTDOMAINDIR', and 'TEXTDOMAIN'
|
||||
shell variables, as explained below. See the gettext documentation for
|
||||
additional details not covered here. If the current locale is 'C' or
|
||||
'POSIX', or if there are no translations available, the dollar sign is
|
||||
ignored, and the shell doesn't attempt to translate the string. Since
|
||||
this is a form of quoting, the string always remains double-quoted,
|
||||
whether or not it is translated and replaced.
|
||||
'POSIX', if there are no translations available, of if the string is not
|
||||
translated, the dollar sign is ignored. Since this is a form of double
|
||||
quoting, the string remains double-quoted by default, whether or not it
|
||||
is translated and replaced. If the 'noexpand_translation' option is
|
||||
enabled using the 'shopt' builtin (*note The Shopt Builtin::),
|
||||
translated strings are single-quoted instead of double-quoted.
|
||||
|
||||
The rest of this section is a brief overview of how you use gettext
|
||||
to create translations for strings in a shell script named SCRIPTNAME.
|
||||
@@ -975,11 +977,11 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
|
||||
(( EXPRESSION ))
|
||||
|
||||
The arithmetic EXPRESSION is evaluated according to the rules
|
||||
described below (*note Shell Arithmetic::). The EXPRESSION is
|
||||
expanded as if it were within double quotes, but double quote
|
||||
characters in EXPRESSION are not special and are removed. If the
|
||||
value of the expression is non-zero, the return status is 0;
|
||||
otherwise the return status is 1.
|
||||
described below (*note Shell Arithmetic::). The EXPRESSION
|
||||
undergoes the same expansions as if it were within double quotes,
|
||||
but double quote characters in EXPRESSION are not treated specially
|
||||
are removed. If the value of the expression is non-zero, the
|
||||
return status is 0; otherwise the return status is 1.
|
||||
|
||||
'[[...]]'
|
||||
[[ EXPRESSION ]]
|
||||
@@ -991,9 +993,9 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre
|
||||
and filename expansion. The shell performs tilde expansion,
|
||||
parameter and variable expansion, arithmetic expansion, command
|
||||
substitution, process substitution, and quote removal on those
|
||||
words (as if the words were enclosed in double quotes).
|
||||
Conditional operators such as '-f' must be unquoted to be
|
||||
recognized as primaries.
|
||||
words (the expansions that would occur if the words were enclosed
|
||||
in double quotes). Conditional operators such as '-f' must be
|
||||
unquoted to be recognized as primaries.
|
||||
|
||||
When used with '[[', the '<' and '>' operators sort
|
||||
lexicographically using the current locale.
|
||||
@@ -1463,8 +1465,7 @@ command substitution, arithmetic expansion, and quote removal (*note
|
||||
Shell Parameter Expansion::). If the variable has its 'integer'
|
||||
attribute set, then VALUE is evaluated as an arithmetic expression even
|
||||
if the '$((...))' expansion is not used (*note Arithmetic Expansion::).
|
||||
Word splitting is not performed, with the exception of '"$@"' as
|
||||
explained below. Filename expansion is not performed. Assignment
|
||||
Word splitting and filename expansion are not performed. Assignment
|
||||
statements may also appear as arguments to the 'alias', 'declare',
|
||||
'typeset', 'export', 'readonly', and 'local' builtin commands
|
||||
("declaration" commands). When in POSIX mode (*note Bash POSIX Mode::),
|
||||
@@ -2171,12 +2172,12 @@ is:
|
||||
|
||||
$(( EXPRESSION ))
|
||||
|
||||
The EXPRESSION is treated as if it were within double quotes, but a
|
||||
double quote inside the parentheses is not treated specially. All
|
||||
tokens in the expression undergo parameter and variable expansion,
|
||||
command substitution, and quote removal. The result is treated as the
|
||||
arithmetic expression to be evaluated. Arithmetic expansions may be
|
||||
nested.
|
||||
The EXPRESSION undergoes the same expansions as if it were within
|
||||
double quotes, but double quote characters in EXPRESSION are not treated
|
||||
specially and are removed. All tokens in the expression undergo
|
||||
parameter and variable expansion, command substitution, and quote
|
||||
removal. The result is treated as the arithmetic expression to be
|
||||
evaluated. Arithmetic expansions may be nested.
|
||||
|
||||
The evaluation is performed according to the rules listed below
|
||||
(*note Shell Arithmetic::). If the expression is invalid, Bash prints a
|
||||
@@ -3838,6 +3839,10 @@ standard.
|
||||
If '-s' is used with '-f', the new builtin becomes a special
|
||||
builtin (*note Special Builtins::).
|
||||
|
||||
If no options are supplied and a NAME is not a shell builtin,
|
||||
'enable' will attempt to load NAME from a shared object named NAME,
|
||||
as if the command were 'enable -f NAME NAME'.
|
||||
|
||||
The return status is zero unless a NAME is not a shell builtin or
|
||||
there is an error loading a new builtin from a shared object.
|
||||
|
||||
@@ -3958,6 +3963,9 @@ standard.
|
||||
'%q'
|
||||
Causes 'printf' to output the corresponding ARGUMENT in a
|
||||
format that can be reused as shell input.
|
||||
'%Q'
|
||||
like '%q', but applies any supplied precision to the ARGUMENT
|
||||
before quoting it.
|
||||
'%(DATEFMT)T'
|
||||
Causes 'printf' to output the date-time string resulting from
|
||||
using DATEFMT as a format string for 'strftime'(3). The
|
||||
@@ -4843,6 +4851,11 @@ This builtin allows you to change additional shell optional behavior.
|
||||
filtering possible completions as part of programmable
|
||||
completion.
|
||||
|
||||
'noexpand_translation'
|
||||
If set, Bash encloses the translated results of $"..."
|
||||
quoting in single quotes instead of double quotes. If the
|
||||
string is not translated, this has no effect.
|
||||
|
||||
'nullglob'
|
||||
If set, Bash allows filename patterns which match no files to
|
||||
expand to a null string, rather than themselves.
|
||||
@@ -11508,26 +11521,26 @@ D.1 Index of Shell Builtin Commands
|
||||
(line 147)
|
||||
* hash: Bourne Shell Builtins.
|
||||
(line 191)
|
||||
* help: Bash Builtins. (line 338)
|
||||
* help: Bash Builtins. (line 342)
|
||||
* history: Bash History Builtins.
|
||||
(line 46)
|
||||
* jobs: Job Control Builtins.
|
||||
(line 27)
|
||||
* kill: Job Control Builtins.
|
||||
(line 58)
|
||||
* let: Bash Builtins. (line 357)
|
||||
* local: Bash Builtins. (line 365)
|
||||
* logout: Bash Builtins. (line 381)
|
||||
* mapfile: Bash Builtins. (line 386)
|
||||
* let: Bash Builtins. (line 361)
|
||||
* local: Bash Builtins. (line 369)
|
||||
* logout: Bash Builtins. (line 385)
|
||||
* mapfile: Bash Builtins. (line 390)
|
||||
* popd: Directory Stack Builtins.
|
||||
(line 35)
|
||||
* printf: Bash Builtins. (line 432)
|
||||
* printf: Bash Builtins. (line 436)
|
||||
* pushd: Directory Stack Builtins.
|
||||
(line 69)
|
||||
* pwd: Bourne Shell Builtins.
|
||||
(line 211)
|
||||
* read: Bash Builtins. (line 481)
|
||||
* readarray: Bash Builtins. (line 577)
|
||||
* read: Bash Builtins. (line 488)
|
||||
* readarray: Bash Builtins. (line 584)
|
||||
* readonly: Bourne Shell Builtins.
|
||||
(line 221)
|
||||
* return: Bourne Shell Builtins.
|
||||
@@ -11536,7 +11549,7 @@ D.1 Index of Shell Builtin Commands
|
||||
* shift: Bourne Shell Builtins.
|
||||
(line 261)
|
||||
* shopt: The Shopt Builtin. (line 9)
|
||||
* source: Bash Builtins. (line 586)
|
||||
* source: Bash Builtins. (line 593)
|
||||
* suspend: Job Control Builtins.
|
||||
(line 113)
|
||||
* test: Bourne Shell Builtins.
|
||||
@@ -11545,12 +11558,12 @@ D.1 Index of Shell Builtin Commands
|
||||
(line 359)
|
||||
* trap: Bourne Shell Builtins.
|
||||
(line 365)
|
||||
* type: Bash Builtins. (line 591)
|
||||
* typeset: Bash Builtins. (line 623)
|
||||
* ulimit: Bash Builtins. (line 629)
|
||||
* type: Bash Builtins. (line 598)
|
||||
* typeset: Bash Builtins. (line 630)
|
||||
* ulimit: Bash Builtins. (line 636)
|
||||
* umask: Bourne Shell Builtins.
|
||||
(line 414)
|
||||
* unalias: Bash Builtins. (line 735)
|
||||
* unalias: Bash Builtins. (line 742)
|
||||
* unset: Bourne Shell Builtins.
|
||||
(line 432)
|
||||
* wait: Job Control Builtins.
|
||||
@@ -12212,138 +12225,138 @@ D.5 Concept Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top889
|
||||
Node: Introduction2801
|
||||
Node: What is Bash?3017
|
||||
Node: What is a shell?4131
|
||||
Node: Definitions6669
|
||||
Node: Basic Shell Features9620
|
||||
Node: Shell Syntax10839
|
||||
Node: Shell Operation11865
|
||||
Node: Quoting13158
|
||||
Node: Escape Character14462
|
||||
Node: Single Quotes14947
|
||||
Node: Double Quotes15295
|
||||
Node: ANSI-C Quoting16573
|
||||
Node: Locale Translation17883
|
||||
Node: Creating Internationalized Scripts19038
|
||||
Node: Comments23155
|
||||
Node: Shell Commands23773
|
||||
Node: Reserved Words24711
|
||||
Node: Simple Commands25467
|
||||
Node: Pipelines26121
|
||||
Node: Lists29080
|
||||
Node: Compound Commands30875
|
||||
Node: Looping Constructs31887
|
||||
Node: Conditional Constructs34382
|
||||
Node: Command Grouping48672
|
||||
Node: Coprocesses50150
|
||||
Node: GNU Parallel52813
|
||||
Node: Shell Functions53730
|
||||
Node: Shell Parameters61021
|
||||
Node: Positional Parameters65472
|
||||
Node: Special Parameters66374
|
||||
Node: Shell Expansions69588
|
||||
Node: Brace Expansion71715
|
||||
Node: Tilde Expansion74449
|
||||
Node: Shell Parameter Expansion77070
|
||||
Node: Command Substitution92199
|
||||
Node: Arithmetic Expansion93554
|
||||
Node: Process Substitution94486
|
||||
Node: Word Splitting95606
|
||||
Node: Filename Expansion97550
|
||||
Node: Pattern Matching100150
|
||||
Node: Quote Removal104758
|
||||
Node: Redirections105053
|
||||
Node: Executing Commands114713
|
||||
Node: Simple Command Expansion115383
|
||||
Node: Command Search and Execution117337
|
||||
Node: Command Execution Environment119715
|
||||
Node: Environment122750
|
||||
Node: Exit Status124413
|
||||
Node: Signals126197
|
||||
Node: Shell Scripts128164
|
||||
Node: Shell Builtin Commands131177
|
||||
Node: Bourne Shell Builtins133215
|
||||
Node: Bash Builtins154676
|
||||
Node: Modifying Shell Behavior185190
|
||||
Node: The Set Builtin185535
|
||||
Node: The Shopt Builtin195948
|
||||
Node: Special Builtins211158
|
||||
Node: Shell Variables212137
|
||||
Node: Bourne Shell Variables212574
|
||||
Node: Bash Variables214678
|
||||
Node: Bash Features247493
|
||||
Node: Invoking Bash248506
|
||||
Node: Bash Startup Files254519
|
||||
Node: Interactive Shells259622
|
||||
Node: What is an Interactive Shell?260032
|
||||
Node: Is this Shell Interactive?260681
|
||||
Node: Interactive Shell Behavior261496
|
||||
Node: Bash Conditional Expressions265009
|
||||
Node: Shell Arithmetic269651
|
||||
Node: Aliases272595
|
||||
Node: Arrays275208
|
||||
Node: The Directory Stack281217
|
||||
Node: Directory Stack Builtins282001
|
||||
Node: Controlling the Prompt286261
|
||||
Node: The Restricted Shell289226
|
||||
Node: Bash POSIX Mode291823
|
||||
Node: Shell Compatibility Mode303096
|
||||
Node: Job Control309752
|
||||
Node: Job Control Basics310212
|
||||
Node: Job Control Builtins315214
|
||||
Node: Job Control Variables320614
|
||||
Node: Command Line Editing321770
|
||||
Node: Introduction and Notation323441
|
||||
Node: Readline Interaction325064
|
||||
Node: Readline Bare Essentials326255
|
||||
Node: Readline Movement Commands328038
|
||||
Node: Readline Killing Commands328998
|
||||
Node: Readline Arguments330916
|
||||
Node: Searching331960
|
||||
Node: Readline Init File334146
|
||||
Node: Readline Init File Syntax335407
|
||||
Node: Conditional Init Constructs356687
|
||||
Node: Sample Init File360883
|
||||
Node: Bindable Readline Commands364007
|
||||
Node: Commands For Moving365211
|
||||
Node: Commands For History367262
|
||||
Node: Commands For Text372256
|
||||
Node: Commands For Killing375905
|
||||
Node: Numeric Arguments378938
|
||||
Node: Commands For Completion380077
|
||||
Node: Keyboard Macros384268
|
||||
Node: Miscellaneous Commands384955
|
||||
Node: Readline vi Mode390894
|
||||
Node: Programmable Completion391801
|
||||
Node: Programmable Completion Builtins399581
|
||||
Node: A Programmable Completion Example410276
|
||||
Node: Using History Interactively415523
|
||||
Node: Bash History Facilities416207
|
||||
Node: Bash History Builtins419212
|
||||
Node: History Interaction424220
|
||||
Node: Event Designators427840
|
||||
Node: Word Designators429194
|
||||
Node: Modifiers430954
|
||||
Node: Installing Bash432765
|
||||
Node: Basic Installation433902
|
||||
Node: Compilers and Options437160
|
||||
Node: Compiling For Multiple Architectures437901
|
||||
Node: Installation Names439594
|
||||
Node: Specifying the System Type440412
|
||||
Node: Sharing Defaults441128
|
||||
Node: Operation Controls441801
|
||||
Node: Optional Features442759
|
||||
Node: Reporting Bugs453559
|
||||
Node: Major Differences From The Bourne Shell454834
|
||||
Node: GNU Free Documentation License471684
|
||||
Node: Indexes496861
|
||||
Node: Builtin Index497315
|
||||
Node: Reserved Word Index504142
|
||||
Node: Variable Index506590
|
||||
Node: Function Index523082
|
||||
Node: Concept Index536866
|
||||
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 Translation17891
|
||||
Node: Creating Internationalized Scripts19202
|
||||
Node: Comments23319
|
||||
Node: Shell Commands23937
|
||||
Node: Reserved Words24875
|
||||
Node: Simple Commands25631
|
||||
Node: Pipelines26285
|
||||
Node: Lists29244
|
||||
Node: Compound Commands31039
|
||||
Node: Looping Constructs32051
|
||||
Node: Conditional Constructs34546
|
||||
Node: Command Grouping48890
|
||||
Node: Coprocesses50368
|
||||
Node: GNU Parallel53031
|
||||
Node: Shell Functions53948
|
||||
Node: Shell Parameters61239
|
||||
Node: Positional Parameters65627
|
||||
Node: Special Parameters66529
|
||||
Node: Shell Expansions69743
|
||||
Node: Brace Expansion71870
|
||||
Node: Tilde Expansion74604
|
||||
Node: Shell Parameter Expansion77225
|
||||
Node: Command Substitution92354
|
||||
Node: Arithmetic Expansion93709
|
||||
Node: Process Substitution94677
|
||||
Node: Word Splitting95797
|
||||
Node: Filename Expansion97741
|
||||
Node: Pattern Matching100341
|
||||
Node: Quote Removal104949
|
||||
Node: Redirections105244
|
||||
Node: Executing Commands114904
|
||||
Node: Simple Command Expansion115574
|
||||
Node: Command Search and Execution117528
|
||||
Node: Command Execution Environment119906
|
||||
Node: Environment122941
|
||||
Node: Exit Status124604
|
||||
Node: Signals126388
|
||||
Node: Shell Scripts128355
|
||||
Node: Shell Builtin Commands131368
|
||||
Node: Bourne Shell Builtins133406
|
||||
Node: Bash Builtins154867
|
||||
Node: Modifying Shell Behavior185684
|
||||
Node: The Set Builtin186029
|
||||
Node: The Shopt Builtin196442
|
||||
Node: Special Builtins211871
|
||||
Node: Shell Variables212850
|
||||
Node: Bourne Shell Variables213287
|
||||
Node: Bash Variables215391
|
||||
Node: Bash Features248206
|
||||
Node: Invoking Bash249219
|
||||
Node: Bash Startup Files255232
|
||||
Node: Interactive Shells260335
|
||||
Node: What is an Interactive Shell?260745
|
||||
Node: Is this Shell Interactive?261394
|
||||
Node: Interactive Shell Behavior262209
|
||||
Node: Bash Conditional Expressions265722
|
||||
Node: Shell Arithmetic270364
|
||||
Node: Aliases273308
|
||||
Node: Arrays275921
|
||||
Node: The Directory Stack281930
|
||||
Node: Directory Stack Builtins282714
|
||||
Node: Controlling the Prompt286974
|
||||
Node: The Restricted Shell289939
|
||||
Node: Bash POSIX Mode292536
|
||||
Node: Shell Compatibility Mode303809
|
||||
Node: Job Control310465
|
||||
Node: Job Control Basics310925
|
||||
Node: Job Control Builtins315927
|
||||
Node: Job Control Variables321327
|
||||
Node: Command Line Editing322483
|
||||
Node: Introduction and Notation324154
|
||||
Node: Readline Interaction325777
|
||||
Node: Readline Bare Essentials326968
|
||||
Node: Readline Movement Commands328751
|
||||
Node: Readline Killing Commands329711
|
||||
Node: Readline Arguments331629
|
||||
Node: Searching332673
|
||||
Node: Readline Init File334859
|
||||
Node: Readline Init File Syntax336120
|
||||
Node: Conditional Init Constructs357400
|
||||
Node: Sample Init File361596
|
||||
Node: Bindable Readline Commands364720
|
||||
Node: Commands For Moving365924
|
||||
Node: Commands For History367975
|
||||
Node: Commands For Text372969
|
||||
Node: Commands For Killing376618
|
||||
Node: Numeric Arguments379651
|
||||
Node: Commands For Completion380790
|
||||
Node: Keyboard Macros384981
|
||||
Node: Miscellaneous Commands385668
|
||||
Node: Readline vi Mode391607
|
||||
Node: Programmable Completion392514
|
||||
Node: Programmable Completion Builtins400294
|
||||
Node: A Programmable Completion Example410989
|
||||
Node: Using History Interactively416236
|
||||
Node: Bash History Facilities416920
|
||||
Node: Bash History Builtins419925
|
||||
Node: History Interaction424933
|
||||
Node: Event Designators428553
|
||||
Node: Word Designators429907
|
||||
Node: Modifiers431667
|
||||
Node: Installing Bash433478
|
||||
Node: Basic Installation434615
|
||||
Node: Compilers and Options437873
|
||||
Node: Compiling For Multiple Architectures438614
|
||||
Node: Installation Names440307
|
||||
Node: Specifying the System Type441125
|
||||
Node: Sharing Defaults441841
|
||||
Node: Operation Controls442514
|
||||
Node: Optional Features443472
|
||||
Node: Reporting Bugs454272
|
||||
Node: Major Differences From The Bourne Shell455547
|
||||
Node: GNU Free Documentation License472397
|
||||
Node: Indexes497574
|
||||
Node: Builtin Index498028
|
||||
Node: Reserved Word Index504855
|
||||
Node: Variable Index507303
|
||||
Node: Function Index523795
|
||||
Node: Concept Index537579
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
+14
-5
@@ -546,11 +546,14 @@ translation, using the @code{LC_MESSAGES}, @code{TEXTDOMAINDIR},
|
||||
and @code{TEXTDOMAIN} shell variables, as explained below.
|
||||
See the gettext documentation for additional details not covered here.
|
||||
If the current locale is @code{C} or @code{POSIX},
|
||||
or if there are no translations available,
|
||||
the dollar sign is ignored, and the shell doesn't attempt to translate the
|
||||
string.
|
||||
Since this is a form of double quoting, the string remains double-quoted,
|
||||
whether or not it is translated and replaced.
|
||||
if there are no translations available,
|
||||
of if the string is not translated,
|
||||
the dollar sign is ignored.
|
||||
Since this is a form of double quoting, the string remains double-quoted
|
||||
by default, whether or not it is translated and replaced.
|
||||
If the @code{noexpand_translation} option is enabled
|
||||
using the @code{shopt} builtin (@pxref{The Shopt Builtin}),
|
||||
translated strings are single-quoted instead of double-quoted.
|
||||
|
||||
The rest of this section is a brief overview of how you use gettext to
|
||||
create translations for strings in a shell script named @var{scriptname}.
|
||||
@@ -5649,6 +5652,12 @@ conditional commands (@pxref{Conditional Constructs},
|
||||
when performing pattern substitution word expansions,
|
||||
or when filtering possible completions as part of programmable completion.
|
||||
|
||||
@item noexpand_translation
|
||||
If set, Bash
|
||||
encloses the translated results of $"..." quoting in single quotes
|
||||
instead of double quotes.
|
||||
If the string is not translated, this has no effect.
|
||||
|
||||
@item nullglob
|
||||
If set, Bash allows filename patterns which match no
|
||||
files to expand to a null string, rather than themselves.
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
Copyright (C) 1988-2021 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Fri Aug 6 14:31:16 EDT 2021
|
||||
@set LASTCHANGE Tue Aug 10 11:06:03 EDT 2021
|
||||
|
||||
@set EDITION 5.1
|
||||
@set VERSION 5.1
|
||||
|
||||
@set UPDATED 6 August 2021
|
||||
@set UPDATED 10 August 2021
|
||||
@set UPDATED-MONTH August 2021
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* externs.h -- extern function declarations which do not appear in their
|
||||
own header file. */
|
||||
|
||||
/* Copyright (C) 1993-2020 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -142,7 +142,7 @@ extern void set_default_lang PARAMS((void));
|
||||
extern char *get_locale_var PARAMS((char *));
|
||||
extern char *localetrans PARAMS((char *, int, int *));
|
||||
extern char *mk_msgstr PARAMS((char *, int *));
|
||||
extern char *localeexpand PARAMS((char *, int, int, int, int *));
|
||||
extern char *locale_expand PARAMS((char *, int, int, int, int *));
|
||||
#ifndef locale_decpoint
|
||||
extern int locale_decpoint PARAMS((void));
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
./CWRU/CWRU.chlog
|
||||
./tests/shopt.right
|
||||
./doc/bashref.info
|
||||
./doc/bashref.texi
|
||||
./doc/version.texi
|
||||
./doc/bash.1
|
||||
./parse.y
|
||||
./externs.h
|
||||
./builtins/shopt.def
|
||||
./locale.c
|
||||
./subst.c
|
||||
@@ -47,6 +47,8 @@ int locale_utf8locale;
|
||||
int locale_mb_cur_max; /* value of MB_CUR_MAX for current locale (LC_CTYPE) */
|
||||
int locale_shiftstates = 0;
|
||||
|
||||
int singlequote_translations = 0; /* single-quote output of $"..." */
|
||||
|
||||
extern int dump_translatable_strings, dump_po_strings;
|
||||
|
||||
/* The current locale when the program begins */
|
||||
@@ -512,7 +514,7 @@ mk_msgstr (string, foundnlp)
|
||||
by the caller. The length of the translated string is returned in LENP,
|
||||
if non-null. */
|
||||
char *
|
||||
localeexpand (string, start, end, lineno, lenp)
|
||||
locale_expand (string, start, end, lineno, lenp)
|
||||
char *string;
|
||||
int start, end, lineno, *lenp;
|
||||
{
|
||||
|
||||
@@ -119,6 +119,7 @@ extern int extended_glob;
|
||||
#endif
|
||||
|
||||
extern int dump_translatable_strings, dump_po_strings;
|
||||
extern int singlequote_translations;
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
@@ -3858,6 +3859,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Should we quote CTLESC here? */
|
||||
nestret = ttrans;
|
||||
nestlen = ttranslen;
|
||||
}
|
||||
@@ -3867,12 +3869,27 @@ parse_matched_pair (qc, open, close, lenp, flags)
|
||||
{
|
||||
/* Locale expand $"..." here. */
|
||||
/* PST_NOEXPAND */
|
||||
ttrans = localeexpand (nestret, 0, nestlen - 1, start_lineno, &ttranslen);
|
||||
ttrans = locale_expand (nestret, 0, nestlen - 1, start_lineno, &ttranslen);
|
||||
free (nestret);
|
||||
|
||||
nestret = sh_mkdoublequoted (ttrans, ttranslen, 0);
|
||||
/* If we're supposed to single-quote translated strings,
|
||||
check whether the translated result is different from
|
||||
the original and single-quote the string if it is. */
|
||||
if (singlequote_translations &&
|
||||
((nestlen - 1) != ttranslen || STREQN (nestret, ttrans, ttranslen) == 0))
|
||||
{
|
||||
if ((rflags & P_DQUOTE) == 0)
|
||||
nestret = sh_single_quote (ttrans);
|
||||
else if ((rflags & P_DQUOTE) && (dolbrace_state == DOLBRACE_QUOTE2) && (flags & P_DOLBRACE))
|
||||
nestret = sh_single_quote (ttrans);
|
||||
else
|
||||
/* single quotes aren't special, use backslash instead */
|
||||
nestret = sh_backslash_quote_for_double_quotes (ttrans);
|
||||
}
|
||||
else
|
||||
nestret = sh_mkdoublequoted (ttrans, ttranslen, 0);
|
||||
free (ttrans);
|
||||
nestlen = ttranslen + 2;
|
||||
nestlen = strlen (nestret);
|
||||
retind -= 2; /* back up before the $" */
|
||||
}
|
||||
|
||||
@@ -4881,14 +4898,20 @@ read_token_word (character)
|
||||
{
|
||||
/* PST_NOEXPAND */
|
||||
/* Try to locale-expand the converted string. */
|
||||
ttrans = localeexpand (ttok, 0, ttoklen - 1, first_line, &ttranslen);
|
||||
ttrans = locale_expand (ttok, 0, ttoklen - 1, first_line, &ttranslen);
|
||||
free (ttok);
|
||||
|
||||
/* Add the double quotes back */
|
||||
ttok = sh_mkdoublequoted (ttrans, ttranslen, 0);
|
||||
/* Add the double quotes back (or single quotes if the user
|
||||
has set that option). */
|
||||
if (singlequote_translations &&
|
||||
((ttoklen - 1) != ttranslen || STREQN (ttok, ttrans, ttranslen) == 0))
|
||||
ttok = sh_single_quote (ttrans);
|
||||
else
|
||||
ttok = sh_mkdoublequoted (ttrans, ttranslen, 0);
|
||||
|
||||
free (ttrans);
|
||||
ttranslen += 2;
|
||||
ttrans = ttok;
|
||||
ttranslen = strlen (ttrans);
|
||||
}
|
||||
|
||||
RESIZE_MALLOCED_BUFFER (token, token_index, ttranslen + 1,
|
||||
|
||||
@@ -189,6 +189,7 @@ int fail_glob_expansion;
|
||||
/* Extern functions and variables from different files. */
|
||||
extern struct fd_bitmap *current_fds_to_close;
|
||||
extern int wordexp_only;
|
||||
extern int singlequote_translations;
|
||||
|
||||
#if defined (JOB_CONTROL) && defined (PROCESS_SUBSTITUTION)
|
||||
extern PROCESS *last_procsub_child;
|
||||
@@ -3808,9 +3809,13 @@ expand_string_dollar_quote (string, flags)
|
||||
{
|
||||
news = ++sindex;
|
||||
t = string_extract_double_quoted (string, &news, SX_COMPLETE);
|
||||
trans = localeexpand (t, 0, news-sindex, 0, &translen);
|
||||
trans = locale_expand (t, 0, news-sindex, 0, &translen);
|
||||
free (t);
|
||||
t = sh_mkdoublequoted (trans, translen, 0);
|
||||
if (singlequote_translations &&
|
||||
((news-sindex-1) != translen || STREQN (t, trans, translen) == 0))
|
||||
t = sh_single_quote (trans);
|
||||
else
|
||||
t = sh_mkdoublequoted (trans, translen, 0);
|
||||
sindex = news;
|
||||
}
|
||||
free (trans);
|
||||
|
||||
@@ -46,6 +46,7 @@ shopt -u mailwarn
|
||||
shopt -u no_empty_cmd_completion
|
||||
shopt -u nocaseglob
|
||||
shopt -u nocasematch
|
||||
shopt -u noexpand_translation
|
||||
shopt -u nullglob
|
||||
shopt -s progcomp
|
||||
shopt -u progcomp_alias
|
||||
@@ -109,6 +110,7 @@ shopt -u mailwarn
|
||||
shopt -u no_empty_cmd_completion
|
||||
shopt -u nocaseglob
|
||||
shopt -u nocasematch
|
||||
shopt -u noexpand_translation
|
||||
shopt -u nullglob
|
||||
shopt -u progcomp_alias
|
||||
shopt -u restricted_shell
|
||||
@@ -152,6 +154,7 @@ mailwarn off
|
||||
no_empty_cmd_completion off
|
||||
nocaseglob off
|
||||
nocasematch off
|
||||
noexpand_translation off
|
||||
nullglob off
|
||||
progcomp_alias off
|
||||
restricted_shell off
|
||||
|
||||
Reference in New Issue
Block a user