diff --git a/COMPAT b/COMPAT index 4b5488e6..ce6a791c 100644 --- a/COMPAT +++ b/COMPAT @@ -399,6 +399,11 @@ above. 61. Bash-5.0 doesn't allow a `break' or `continue' in a subshell to attempt to break or continue loop execution inherited from the calling context. +62. Bash-5.0 doesn't allow variable assignments preceding builtins like + export and readonly to modify variables with the same name in preceding + contexts (including the global context) unless the shell is in posix + mode, since export and readonly are special builtins. + Shell Compatibility Level ========================= @@ -466,6 +471,10 @@ compat44 set debug mode is not enabled - a subshell inherits loops from its parent contenxt, so `break' or `continue' will cause the subshell to exit + - variable assignments preceding builtins like export and readonly + that set attributes continue to affect variables with the same + name in the calling environment even if the shell is not in posix + mode ------------------------------------------------------------------------------- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index ac0e4d5b..3d35d219 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -15467,3 +15467,26 @@ variables.c - assign_aliasvar: perform same validity check on subscript assignment as alias builtin performs on name argument. Bug report from Mike Jonkmans + + 5/29 + ---- +builtins/setattr.def + - set_var_attribute: we should not propagate a variable assignment + preceding a builtin back to the calling environment unless the + shell is in posix mode. Since previous versions of the shell do + this, setting the shell compatibility level to 44 or less will + continue the propagation behavior + + 6/1 + --- +lib/readline/histexpand.c + - history_tokenize_word: as part of teaching history tokenization more + and more about shell syntax, allow command and process subsitution + and extended globbing patterns to appear within a word being + tokenized and not just at the beginning. Fixes bug reported back in + 2/2017 by ecki@tofex.de + +bashhist.c + - load_history: use HISTSIZE_DEFAULT (still defaults to "500") to set + the initial value of $HISTSIZE. HISTSIZE_DEFAULT can be overridden + in config-top.h diff --git a/MANIFEST b/MANIFEST index 09c5e651..cde3410f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1073,6 +1073,7 @@ tests/histexp1.sub f tests/histexp2.sub f tests/histexp3.sub f tests/histexp4.sub f +tests/histexp5.sub f tests/histexp.right f tests/history.tests f tests/history.right f @@ -1180,6 +1181,7 @@ tests/posixexp3.sub f tests/posixexp4.sub f tests/posixexp5.sub f tests/posixexp6.sub f +tests/posixexp7.sub f tests/posixexp2.tests f tests/posixexp2.right f tests/posixpat.tests f diff --git a/bashhist.c b/bashhist.c index e0afe52a..1672f139 100644 --- a/bashhist.c +++ b/bashhist.c @@ -60,6 +60,10 @@ extern int rl_done, rl_dispatching; /* should really include readline.h */ #endif +#ifndef HISTSIZE_DEFAULT +# define HISTSIZE_DEFAULT "500" +#endif + #if !defined (errno) extern int errno; #endif @@ -305,7 +309,7 @@ load_history () Note that the history file is automatically truncated to the size of HISTSIZE if the user does not explicitly set the size differently. */ - set_if_not ("HISTSIZE", "500"); + set_if_not ("HISTSIZE", HISTSIZE_DEFAULT); sv_histsize ("HISTSIZE"); set_if_not ("HISTFILESIZE", get_string_value ("HISTSIZE")); diff --git a/builtins/setattr.def b/builtins/setattr.def index 916515f8..c756964a 100644 --- a/builtins/setattr.def +++ b/builtins/setattr.def @@ -560,18 +560,23 @@ set_var_attribute (name, attribute, undo) var->attributes |= tv->attributes & ~att_tempvar; /* This avoids an error message when propagating a read-only var later on. */ - if (var->context == 0 && (attribute & att_readonly)) + if (posixly_correct || shell_compatibility_level <= 44) { - /* Don't bother to set the `propagate to the global variables - table' flag if we've just bound the variable in that table */ - v = find_global_variable (tv->name); - if (v != var) + if (var->context == 0 && (attribute & att_readonly)) + { + /* Don't bother to set the `propagate to the global variables + table' flag if we've just bound the variable in that + table */ + v = find_global_variable (tv->name); + if (v != var) + VSETATTR (tv, att_propagate); + } + else VSETATTR (tv, att_propagate); + if (var->context != 0) + VSETATTR (var, att_propagate); } - else - VSETATTR (tv, att_propagate); - if (var->context != 0) - VSETATTR (var, att_propagate); + SETVARATTR (tv, attribute, undo); /* XXX */ stupidly_hack_special_variables (tv->name); diff --git a/config-top.h b/config-top.h index a7008bca..b1ed925f 100644 --- a/config-top.h +++ b/config-top.h @@ -176,3 +176,7 @@ /* Define to force the value of OLDPWD inherited from the environment to be a directory */ #define OLDPWD_CHECK_DIRECTORY 1 + +/* Define to set the initial size of the history list ($HISTSIZE). This must + be a string. */ +/*#define HISTSIZE_DEFAULT "500"*/ diff --git a/doc/bashref.aux b/doc/bashref.aux index 90e4b15e..8ee06423 100644 --- a/doc/bashref.aux +++ b/doc/bashref.aux @@ -66,9 +66,9 @@ @xrdef{Command Grouping-pg}{14} @xrdef{Coprocesses-title}{Coprocesses} @xrdef{Coprocesses-snt}{Section@tie 3.2.5} +@xrdef{Coprocesses-pg}{15} @xrdef{GNU Parallel-title}{GNU Parallel} @xrdef{GNU Parallel-snt}{Section@tie 3.2.6} -@xrdef{Coprocesses-pg}{15} @xrdef{GNU Parallel-pg}{16} @xrdef{Shell Functions-title}{Shell Functions} @xrdef{Shell Functions-snt}{Section@tie 3.3} @@ -80,67 +80,67 @@ @xrdef{Positional Parameters-snt}{Section@tie 3.4.1} @xrdef{Special Parameters-title}{Special Parameters} @xrdef{Special Parameters-snt}{Section@tie 3.4.2} -@xrdef{Positional Parameters-pg}{20} +@xrdef{Positional Parameters-pg}{21} +@xrdef{Special Parameters-pg}{21} @xrdef{Shell Expansions-title}{Shell Expansions} @xrdef{Shell Expansions-snt}{Section@tie 3.5} -@xrdef{Special Parameters-pg}{21} +@xrdef{Shell Expansions-pg}{22} @xrdef{Brace Expansion-title}{Brace Expansion} @xrdef{Brace Expansion-snt}{Section@tie 3.5.1} -@xrdef{Shell Expansions-pg}{22} -@xrdef{Brace Expansion-pg}{22} @xrdef{Tilde Expansion-title}{Tilde Expansion} @xrdef{Tilde Expansion-snt}{Section@tie 3.5.2} +@xrdef{Brace Expansion-pg}{23} @xrdef{Tilde Expansion-pg}{23} @xrdef{Shell Parameter Expansion-title}{Shell Parameter Expansion} @xrdef{Shell Parameter Expansion-snt}{Section@tie 3.5.3} @xrdef{Shell Parameter Expansion-pg}{24} @xrdef{Command Substitution-title}{Command Substitution} @xrdef{Command Substitution-snt}{Section@tie 3.5.4} +@xrdef{Command Substitution-pg}{30} @xrdef{Arithmetic Expansion-title}{Arithmetic Expansion} @xrdef{Arithmetic Expansion-snt}{Section@tie 3.5.5} @xrdef{Process Substitution-title}{Process Substitution} @xrdef{Process Substitution-snt}{Section@tie 3.5.6} -@xrdef{Command Substitution-pg}{30} -@xrdef{Arithmetic Expansion-pg}{30} -@xrdef{Process Substitution-pg}{30} @xrdef{Word Splitting-title}{Word Splitting} @xrdef{Word Splitting-snt}{Section@tie 3.5.7} +@xrdef{Arithmetic Expansion-pg}{31} +@xrdef{Process Substitution-pg}{31} +@xrdef{Word Splitting-pg}{31} @xrdef{Filename Expansion-title}{Filename Expansion} @xrdef{Filename Expansion-snt}{Section@tie 3.5.8} -@xrdef{Word Splitting-pg}{31} -@xrdef{Filename Expansion-pg}{31} @xrdef{Pattern Matching-title}{Pattern Matching} @xrdef{Pattern Matching-snt}{Section@tie 3.5.8.1} +@xrdef{Filename Expansion-pg}{32} @xrdef{Pattern Matching-pg}{32} @xrdef{Quote Removal-title}{Quote Removal} @xrdef{Quote Removal-snt}{Section@tie 3.5.9} @xrdef{Redirections-title}{Redirections} @xrdef{Redirections-snt}{Section@tie 3.6} -@xrdef{Quote Removal-pg}{33} -@xrdef{Redirections-pg}{33} +@xrdef{Quote Removal-pg}{34} +@xrdef{Redirections-pg}{34} @xrdef{Executing Commands-title}{Executing Commands} @xrdef{Executing Commands-snt}{Section@tie 3.7} @xrdef{Simple Command Expansion-title}{Simple Command Expansion} @xrdef{Simple Command Expansion-snt}{Section@tie 3.7.1} -@xrdef{Executing Commands-pg}{37} -@xrdef{Simple Command Expansion-pg}{37} @xrdef{Command Search and Execution-title}{Command Search and Execution} @xrdef{Command Search and Execution-snt}{Section@tie 3.7.2} +@xrdef{Executing Commands-pg}{38} +@xrdef{Simple Command Expansion-pg}{38} +@xrdef{Command Search and Execution-pg}{38} @xrdef{Command Execution Environment-title}{Command Execution Environment} @xrdef{Command Execution Environment-snt}{Section@tie 3.7.3} -@xrdef{Command Search and Execution-pg}{38} -@xrdef{Command Execution Environment-pg}{38} +@xrdef{Command Execution Environment-pg}{39} @xrdef{Environment-title}{Environment} @xrdef{Environment-snt}{Section@tie 3.7.4} -@xrdef{Environment-pg}{39} @xrdef{Exit Status-title}{Exit Status} @xrdef{Exit Status-snt}{Section@tie 3.7.5} +@xrdef{Environment-pg}{40} +@xrdef{Exit Status-pg}{40} @xrdef{Signals-title}{Signals} @xrdef{Signals-snt}{Section@tie 3.7.6} -@xrdef{Exit Status-pg}{40} -@xrdef{Signals-pg}{40} @xrdef{Shell Scripts-title}{Shell Scripts} @xrdef{Shell Scripts-snt}{Section@tie 3.8} +@xrdef{Signals-pg}{41} @xrdef{Shell Scripts-pg}{41} @xrdef{Shell Builtin Commands-title}{Shell Builtin Commands} @xrdef{Shell Builtin Commands-snt}{Chapter@tie 4} diff --git a/doc/bashref.cp b/doc/bashref.cp index 398cd939..6f910575 100644 --- a/doc/bashref.cp +++ b/doc/bashref.cp @@ -42,34 +42,34 @@ \entry{parameters}{19}{parameters} \entry{variable, shell}{19}{variable, shell} \entry{shell variable}{19}{shell variable} -\entry{parameters, positional}{20}{parameters, positional} +\entry{parameters, positional}{21}{parameters, positional} \entry{parameters, special}{21}{parameters, special} \entry{expansion}{22}{expansion} -\entry{brace expansion}{22}{brace expansion} -\entry{expansion, brace}{22}{expansion, brace} +\entry{brace expansion}{23}{brace expansion} +\entry{expansion, brace}{23}{expansion, brace} \entry{tilde expansion}{23}{tilde expansion} \entry{expansion, tilde}{23}{expansion, tilde} \entry{parameter expansion}{24}{parameter expansion} \entry{expansion, parameter}{24}{expansion, parameter} \entry{command substitution}{30}{command substitution} -\entry{expansion, arithmetic}{30}{expansion, arithmetic} -\entry{arithmetic expansion}{30}{arithmetic expansion} -\entry{process substitution}{30}{process substitution} +\entry{expansion, arithmetic}{31}{expansion, arithmetic} +\entry{arithmetic expansion}{31}{arithmetic expansion} +\entry{process substitution}{31}{process substitution} \entry{word splitting}{31}{word splitting} -\entry{expansion, filename}{31}{expansion, filename} -\entry{expansion, pathname}{31}{expansion, pathname} -\entry{filename expansion}{31}{filename expansion} -\entry{pathname expansion}{31}{pathname expansion} +\entry{expansion, filename}{32}{expansion, filename} +\entry{expansion, pathname}{32}{expansion, pathname} +\entry{filename expansion}{32}{filename expansion} +\entry{pathname expansion}{32}{pathname expansion} \entry{pattern matching}{32}{pattern matching} \entry{matching, pattern}{32}{matching, pattern} -\entry{redirection}{33}{redirection} -\entry{command expansion}{37}{command expansion} +\entry{redirection}{34}{redirection} +\entry{command expansion}{38}{command expansion} \entry{command execution}{38}{command execution} \entry{command search}{38}{command search} -\entry{execution environment}{38}{execution environment} -\entry{environment}{39}{environment} +\entry{execution environment}{39}{execution environment} +\entry{environment}{40}{environment} \entry{exit status}{40}{exit status} -\entry{signal handling}{40}{signal handling} +\entry{signal handling}{41}{signal handling} \entry{shell script}{41}{shell script} \entry{special builtin}{71}{special builtin} \entry{login shell}{86}{login shell} diff --git a/doc/bashref.cps b/doc/bashref.cps index 8c37c161..eb4fc3f0 100644 --- a/doc/bashref.cps +++ b/doc/bashref.cps @@ -1,7 +1,7 @@ \initial {A} \entry {alias expansion}{92} \entry {arithmetic evaluation}{91} -\entry {arithmetic expansion}{30} +\entry {arithmetic expansion}{31} \entry {arithmetic, shell}{91} \entry {arrays}{93} \initial {B} @@ -9,12 +9,12 @@ \entry {Bash configuration}{145} \entry {Bash installation}{145} \entry {Bourne shell}{5} -\entry {brace expansion}{22} +\entry {brace expansion}{23} \entry {builtin}{3} \initial {C} \entry {command editing}{107} \entry {command execution}{38} -\entry {command expansion}{37} +\entry {command expansion}{38} \entry {command history}{140} \entry {command search}{38} \entry {command substitution}{30} @@ -36,24 +36,24 @@ \entry {directory stack}{95} \initial {E} \entry {editing command lines}{107} -\entry {environment}{39} +\entry {environment}{40} \entry {evaluation, arithmetic}{91} \entry {event designators}{143} -\entry {execution environment}{38} +\entry {execution environment}{39} \entry {exit status}{3, 40} \entry {expansion}{22} -\entry {expansion, arithmetic}{30} -\entry {expansion, brace}{22} -\entry {expansion, filename}{31} +\entry {expansion, arithmetic}{31} +\entry {expansion, brace}{23} +\entry {expansion, filename}{32} \entry {expansion, parameter}{24} -\entry {expansion, pathname}{31} +\entry {expansion, pathname}{32} \entry {expansion, tilde}{23} \entry {expressions, arithmetic}{91} \entry {expressions, conditional}{89} \initial {F} \entry {field}{3} \entry {filename}{3} -\entry {filename expansion}{31} +\entry {filename expansion}{32} \entry {foreground}{102} \entry {functions, shell}{17} \initial {H} @@ -90,16 +90,16 @@ \initial {P} \entry {parameter expansion}{24} \entry {parameters}{19} -\entry {parameters, positional}{20} +\entry {parameters, positional}{21} \entry {parameters, special}{21} -\entry {pathname expansion}{31} +\entry {pathname expansion}{32} \entry {pattern matching}{32} \entry {pipeline}{8} \entry {POSIX}{3} \entry {POSIX Mode}{98} \entry {process group}{3} \entry {process group ID}{3} -\entry {process substitution}{30} +\entry {process substitution}{31} \entry {programmable completion}{131} \entry {prompting}{96} \initial {Q} @@ -107,7 +107,7 @@ \entry {quoting, ANSI}{6} \initial {R} \entry {Readline, how to use}{105} -\entry {redirection}{33} +\entry {redirection}{34} \entry {reserved word}{3} \entry {restricted shell}{97} \entry {return status}{4} @@ -118,7 +118,7 @@ \entry {shell variable}{19} \entry {shell, interactive}{87} \entry {signal}{4} -\entry {signal handling}{40} +\entry {signal handling}{41} \entry {special builtin}{4, 71} \entry {startup files}{86} \entry {suspending jobs}{102} diff --git a/doc/bashref.log b/doc/bashref.log index 6e850e1d..205b362e 100644 --- a/doc/bashref.log +++ b/doc/bashref.log @@ -1,11 +1,11 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/MacPorts 2017_2) (preloaded format=pdfetex 2017.7.5) 19 MAR 2018 09:43 +This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/MacPorts 2017_3) (preloaded format=pdfetex 2018.4.5) 2 JUN 2018 20:48 entering extended mode restricted \write18 enabled. file:line:error style messages enabled. %&-line parsing enabled. -**\input /usr/homes/chet/src/bash/src/doc/bashref.texi -(/usr/homes/chet/src/bash/src/doc/bashref.texi -(/Users/chet/src/bash/src/doc/texinfo.tex +**\input /usr/src/local/bash/bash-20180601/doc/bashref.texi +(/usr/src/local/bash/bash-20180601/doc/bashref.texi +(/usr/src/local/bash/bash-20180601/doc/texinfo.tex Loading texinfo [version 2015-11-22.14]: \outerhsize=\dimen16 \outervsize=\dimen17 @@ -161,22 +161,23 @@ This is `epsf.tex' v2.7.4 <14 February 2011> texinfo.tex: doing @include of version.texi -(/Users/chet/src/bash/src/doc/version.texi) [1{/opt/local/var/db/texmf/fonts/ma -p/pdftex/updmap/pdftex.map}] [2] (/Users/chet/src/bash/src/doc/bashref.toc -[-1] [-2] [-3]) [-4] (/Users/chet/src/bash/src/doc/bashref.toc) -(/Users/chet/src/bash/src/doc/bashref.toc) Chapter 1 +(/usr/src/local/bash/bash-20180601/doc/version.texi) [1{/opt/local/var/db/texmf +/fonts/map/pdftex/updmap/pdftex.map}] [2] +(/usr/src/local/bash/bash-20180601/doc/bashref.toc [-1] [-2] [-3]) [-4] +(/usr/src/local/bash/bash-20180601/doc/bashref.toc) +(/usr/src/local/bash/bash-20180601/doc/bashref.toc) Chapter 1 \openout0 = `bashref.toc'. -(/Users/chet/src/bash/src/doc/bashref.aux) +(/usr/src/local/bash/bash-20180601/doc/bashref.aux) \openout1 = `bashref.aux'. Chapter 2 [1] [2] @cpindfile=@write2 \openout2 = `bashref.cp'. - [3] Chapter 3 -[4] [5] [6] + [3] +Chapter 3 [4] [5] [6] @vrindfile=@write3 \openout3 = `bashref.vr'. @@ -184,142 +185,25 @@ p/pdftex/updmap/pdftex.map}] [2] (/Users/chet/src/bash/src/doc/bashref.toc @rwindfile=@write4 \openout4 = `bashref.rw'. - [8] [9] [10] -Overfull \hbox (38.26587pt too wide) in paragraph at lines 879--879 - []@texttt case @textttsl word @texttt in [ [(] @textttsl pat-tern @texttt [| @ -textttsl pattern@texttt ][]) @textttsl command-list @texttt ;;][] esac[] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 86.72375 -.@hbox(0.0+0.0)x0.0 -.@texttt c -.@texttt a -.@texttt s -.etc. - -[11] [12] [13] [14] [15] -Overfull \hbox (89.6747pt too wide) in paragraph at lines 1286--1286 - []@texttt cat list | parallel "do-something1 {} config-{} ; do-something2 < {} -" | process-output[] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@texttt c -.@texttt a -.@texttt t -.etc. - -[16] -Overfull \hbox (89.6747pt too wide) in paragraph at lines 1309--1309 - []@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p -arallel traceroute[] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@texttt { -.@penalty 10000 -.@glue 5.74869 -.etc. - - -Overfull \hbox (106.92076pt too wide) in paragraph at lines 1315--1315 - []@texttt { echo foss.org.my ; echo debian.org; echo freenetproject.org; } | p -arallel -k traceroute[] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@texttt { -.@penalty 10000 -.@glue 5.74869 -.etc. - -[17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] -[32] [33] [34] [35] [36] [37] [38] [39] [40] [41] Chapter 4 [42] + [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] +[18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] +[33] [34] [35] [36] [37] [38] [39] [40] [41] Chapter 4 [42] @btindfile=@write5 \openout5 = `bashref.bt'. - [43] [44] -[45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] -Overfull \hbox (26.76846pt too wide) in paragraph at lines 4356--4356 - []@texttt mapfile [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ] [ --O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl f -d@texttt ][] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 86.72375 -.@hbox(0.0+0.0)x0.0 -.@texttt m -.@texttt a -.@texttt p -.etc. - -[56] [57] -Overfull \hbox (38.26584pt too wide) in paragraph at lines 4564--4564 - []@texttt readarray [-d @textttsl de-lim@texttt ] [-n @textttsl count@texttt ] - [-O @textttsl ori-gin@texttt ] [-s @textttsl count@texttt ] [-t] [-u @textttsl - fd@texttt ][] - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 86.72375 -.@hbox(0.0+0.0)x0.0 -.@texttt r -.@texttt e -.@texttt a -.etc. - -[58] [59] [60] [61] [62] [63] [64] [65] [66] [67] [68] [69] [70] Chapter 5 -[71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] Chapter 6 [83] -Overfull \hbox (49.43388pt too wide) in paragraph at lines 6333--6333 - []@texttt bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@t -exttt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar- - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@kern 0.0 -.@texttt b -.@texttt a -.etc. - - -Overfull \hbox (72.42863pt too wide) in paragraph at lines 6334--6334 - []@texttt bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@texttt -] [-O @textttsl shopt_option@texttt ] -c @textttsl string @texttt [@textttsl ar -- - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@texttt b -.@texttt a -.@texttt s -.etc. - - -Overfull \hbox (32.18782pt too wide) in paragraph at lines 6335--6335 - []@texttt bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @textttsl op-tion@text -tt ] [-O @textttsl shopt_option@texttt ] [@textttsl ar- - -@hbox(7.60416+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@texttt b -.@texttt a -.@texttt s -.etc. - -[84] [85] [86] [87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] -[99] [100] Chapter 7 [101] [102] [103] [104] + [43] [44] [45] +[46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57] [58] [59] [60] +[61] [62] [63] [64] [65] [66] [67] [68] [69] [70] Chapter 5 [71] [72] [73] +[74] [75] [76] [77] [78] [79] [80] [81] [82] Chapter 6 [83] [84] [85] [86] +[87] [88] [89] [90] [91] [92] [93] [94] [95] [96] [97] [98] [99] [100] +Chapter 7 [101] [102] [103] [104] texinfo.tex: doing @include of rluser.texi -(/usr/homes/chet/src/bash/src/lib/readline/doc/rluser.texi Chapter 8 [105] -[106] [107] [108] [109] [110] [111] [112] [113] [114] [115] -Underfull \hbox (badness 7540) in paragraph at lines 805--811 - []@textrm In the above ex-am-ple, @textttsl C-u[] @textrm is bound to the func +(/usr/src/local/bash/bash-20180601/lib/readline/doc/rluser.texi Chapter 8 +[105] [106] [107] [108] [109] [110] [111] [112] [113] [114] [115] +Underfull \hbox (badness 7540) in paragraph at lines 806--812 + []@textrm In the ex-am-ple above, @textttsl C-u[] @textrm is bound to the func -tion @hbox(7.60416+2.12917)x433.62, glue set 4.22592 @@ -331,7 +215,7 @@ Underfull \hbox (badness 7540) in paragraph at lines 805--811 .etc. -Underfull \hbox (badness 10000) in paragraph at lines 805--811 +Underfull \hbox (badness 10000) in paragraph at lines 806--812 @texttt universal-argument[]@textrm , @textttsl M-DEL[] @textrm is bound to th e func-tion @@ -344,9 +228,9 @@ e func-tion .etc. [116] [117] [118] -Overfull \hbox (26.43913pt too wide) in paragraph at lines 1039--1039 - []@texttt Meta-Control-h: backward-kill-word Text after the function name is i -gnored[] +Overfull \hbox (32.18782pt too wide) in paragraph at lines 1040--1040 + []@texttt Meta-Control-h: backward-kill-word Text after the function name is +ignored[] @hbox(6.69167+2.43333)x433.62 .@glue(@leftskip) 28.90755 @@ -361,39 +245,27 @@ gnored[] \openout6 = `bashref.fn'. [121] [122] [123] [124] [125] [126] [127] [128] [129] [130] -[131] [132] [133] [134] [135] [136] -Overfull \hbox (26.43913pt too wide) in paragraph at lines 2292--2292 - [] @texttt # Tilde expansion, with side effect of expanding tilde to full p -athname[] - -@hbox(6.69167+2.43333)x433.62 -.@glue(@leftskip) 28.90755 -.@hbox(0.0+0.0)x0.0 -.@penalty 10000 -.@glue 5.74869 -.@penalty 10000 -.etc. - -[137] [138]) +[131] [132] [133] [134] [135] [136] [137] [138]) texinfo.tex: doing @include of hsuser.texi - (/usr/homes/chet/src/bash/src/lib/readline/doc/hsuser.texi -Chapter 9 [139] [140] [141] [142] [143]) Chapter 10 [144] [145] [146] [147] -[148] [149] [150] [151] Appendix A [152] Appendix B [153] [154] [155] [156] -[157] [158] Appendix C [159] + +(/usr/src/local/bash/bash-20180601/lib/readline/doc/hsuser.texi Chapter 9 +[139] [140] [141] [142] [143]) Chapter 10 [144] [145] [146] [147] [148] +[149] [150] [151] Appendix A [152] Appendix B [153] [154] [155] [156] [157] +[158] Appendix C [159] texinfo.tex: doing @include of fdl.texi - (/Users/chet/src/bash/src/doc/fdl.texi [160] + (/usr/src/local/bash/bash-20180601/doc/fdl.texi [160] [161] [162] [163] [164] [165] [166]) Appendix D [167] [168] [169] [170] [171] [172] [173] [174] [175] [176] ) Here is how much of TeX's memory you used: - 4064 strings out of 497104 - 47069 string characters out of 6206767 - 136596 words of memory out of 5000000 + 4063 strings out of 497104 + 47206 string characters out of 6206767 + 136590 words of memory out of 5000000 4846 multiletter control sequences out of 15000+600000 34315 words of font info for 116 fonts, out of 8000000 for 9000 51 hyphenation exceptions out of 8191 - 16i,6n,16p,326b,968s stack positions out of 5000i,500n,10000p,200000b,80000s + 16i,6n,16p,331b,968s stack positions out of 5000i,500n,10000p,200000b,80000s {/opt/local/share/texmf-texlive/fonts/enc/ dvips/cm-super/cm-super-t1.enc} -Output written on bashref.pdf (182 pages, 747913 bytes). +Output written on bashref.pdf (182 pages, 747871 bytes). PDF statistics: 2615 PDF objects out of 2984 (max. 8388607) 2388 compressed objects within 24 object streams diff --git a/doc/bashref.pdf b/doc/bashref.pdf index 9686b72e..cef7dcc7 100644 Binary files a/doc/bashref.pdf and b/doc/bashref.pdf differ diff --git a/doc/bashref.texi b/doc/bashref.texi index 2f16d353..e2fc386b 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -876,7 +876,9 @@ zero if no condition tested true. The syntax of the @code{case} command is: @example -case @var{word} in [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} esac +case @var{word} in + [ [(] @var{pattern} [| @var{pattern}]@dots{}) @var{command-list} ;;]@dots{} +esac @end example @code{case} will selectively execute the @var{command-list} corresponding to @@ -1283,7 +1285,8 @@ from a file (in this case, filenames listed one per line): @noindent with a more compact syntax reminiscent of lambdas: @example -cat list | parallel "do-something1 @{@} config-@{@} ; do-something2 < @{@}" | process-output +cat list | parallel "do-something1 @{@} config-@{@} ; do-something2 < @{@}" | + process-output @end example Parallel provides a built-in mechanism to remove filename extensions, which @@ -1306,13 +1309,21 @@ parallel "zcat @{@} | bzip2 >@{.@}.bz2 && rm @{@}" ::: *.gz If a command generates output, you may want to preserve the input order in the output. For instance, the following command @example -@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel traceroute +@{ + echo foss.org.my ; + echo debian.org ; + echo freenetproject.org ; +@} | parallel traceroute @end example @noindent will display as output the traceroute invocation that finishes first. Adding the @option{-k} option @example -@{ echo foss.org.my ; echo debian.org; echo freenetproject.org; @} | parallel -k traceroute +@{ + echo foss.org.my ; + echo debian.org ; + echo freenetproject.org ; +@} | parallel -k traceroute @end example @noindent will ensure that the output of @code{traceroute foss.org.my} is displayed first. @@ -4361,8 +4372,8 @@ parent. @item mapfile @btindex mapfile @example -mapfile [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] - [-C @var{callback}] [-c @var{quantum}] [@var{array}] +mapfile [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] + [-t] [-u @var{fd}] [-C @var{callback}] [-c @var{quantum}] [@var{array}] @end example Read lines from the standard input into the indexed array variable @var{array}, @@ -4569,8 +4580,8 @@ Read input from file descriptor @var{fd}. @item readarray @btindex readarray @example -readarray [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] [-t] [-u @var{fd}] - [-C @var{callback}] [-c @var{quantum}] [@var{array}] +readarray [-d @var{delim}] [-n @var{count}] [-O @var{origin}] [-s @var{count}] + [-t] [-u @var{fd}] [-C @var{callback}] [-c @var{quantum}] [@var{array}] @end example Read lines from the standard input into the indexed array variable @var{array}, @@ -6338,9 +6349,12 @@ This chapter describes features unique to Bash. @section Invoking Bash @example -bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}] -bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] -c @var{string} [@var{argument} @dots{}] -bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] [-O @var{shopt_option}] [@var{argument} @dots{}] +bash [long-opt] [-ir] [-abefhkmnptuvxdBCDHP] [-o @var{option}] + [-O @var{shopt_option}] [@var{argument} @dots{}] +bash [long-opt] [-abefhkmnptuvxdBCDHP] [-o @var{option}] + [-O @var{shopt_option}] -c @var{string} [@var{argument} @dots{}] +bash [long-opt] -s [-abefhkmnptuvxdBCDHP] [-o @var{option}] + [-O @var{shopt_option}] [@var{argument} @dots{}] @end example All of the single-character options used with the @code{set} builtin diff --git a/doc/bashref.toc b/doc/bashref.toc index b19642b4..845d78b2 100644 --- a/doc/bashref.toc +++ b/doc/bashref.toc @@ -24,37 +24,37 @@ @numsubsecentry{GNU Parallel}{3.2.6}{GNU Parallel}{16} @numsecentry{Shell Functions}{3.3}{Shell Functions}{17} @numsecentry{Shell Parameters}{3.4}{Shell Parameters}{19} -@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{20} +@numsubsecentry{Positional Parameters}{3.4.1}{Positional Parameters}{21} @numsubsecentry{Special Parameters}{3.4.2}{Special Parameters}{21} @numsecentry{Shell Expansions}{3.5}{Shell Expansions}{22} -@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{22} +@numsubsecentry{Brace Expansion}{3.5.1}{Brace Expansion}{23} @numsubsecentry{Tilde Expansion}{3.5.2}{Tilde Expansion}{23} @numsubsecentry{Shell Parameter Expansion}{3.5.3}{Shell Parameter Expansion}{24} @numsubsecentry{Command Substitution}{3.5.4}{Command Substitution}{30} -@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{30} -@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{30} +@numsubsecentry{Arithmetic Expansion}{3.5.5}{Arithmetic Expansion}{31} +@numsubsecentry{Process Substitution}{3.5.6}{Process Substitution}{31} @numsubsecentry{Word Splitting}{3.5.7}{Word Splitting}{31} -@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{31} +@numsubsecentry{Filename Expansion}{3.5.8}{Filename Expansion}{32} @numsubsubsecentry{Pattern Matching}{3.5.8.1}{Pattern Matching}{32} -@numsubsecentry{Quote Removal}{3.5.9}{Quote Removal}{33} -@numsecentry{Redirections}{3.6}{Redirections}{33} +@numsubsecentry{Quote Removal}{3.5.9}{Quote Removal}{34} +@numsecentry{Redirections}{3.6}{Redirections}{34} @numsubsecentry{Redirecting Input}{3.6.1}{}{35} @numsubsecentry{Redirecting Output}{3.6.2}{}{35} -@numsubsecentry{Appending Redirected Output}{3.6.3}{}{35} -@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{35} +@numsubsecentry{Appending Redirected Output}{3.6.3}{}{36} +@numsubsecentry{Redirecting Standard Output and Standard Error}{3.6.4}{}{36} @numsubsecentry{Appending Standard Output and Standard Error}{3.6.5}{}{36} @numsubsecentry{Here Documents}{3.6.6}{}{36} -@numsubsecentry{Here Strings}{3.6.7}{}{36} -@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{36} +@numsubsecentry{Here Strings}{3.6.7}{}{37} +@numsubsecentry{Duplicating File Descriptors}{3.6.8}{}{37} @numsubsecentry{Moving File Descriptors}{3.6.9}{}{37} @numsubsecentry{Opening File Descriptors for Reading and Writing}{3.6.10}{}{37} -@numsecentry{Executing Commands}{3.7}{Executing Commands}{37} -@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{37} +@numsecentry{Executing Commands}{3.7}{Executing Commands}{38} +@numsubsecentry{Simple Command Expansion}{3.7.1}{Simple Command Expansion}{38} @numsubsecentry{Command Search and Execution}{3.7.2}{Command Search and Execution}{38} -@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{38} -@numsubsecentry{Environment}{3.7.4}{Environment}{39} +@numsubsecentry{Command Execution Environment}{3.7.3}{Command Execution Environment}{39} +@numsubsecentry{Environment}{3.7.4}{Environment}{40} @numsubsecentry{Exit Status}{3.7.5}{Exit Status}{40} -@numsubsecentry{Signals}{3.7.6}{Signals}{40} +@numsubsecentry{Signals}{3.7.6}{Signals}{41} @numsecentry{Shell Scripts}{3.8}{Shell Scripts}{41} @numchapentry{Shell Builtin Commands}{4}{Shell Builtin Commands}{43} @numsecentry{Bourne Shell Builtins}{4.1}{Bourne Shell Builtins}{43} diff --git a/doc/bashref.vr b/doc/bashref.vr index cfcbfe27..c876a009 100644 --- a/doc/bashref.vr +++ b/doc/bashref.vr @@ -9,16 +9,16 @@ \entry{$#}{21}{\code {$#}} \entry{?}{21}{\code {?}} \entry{$?}{21}{\code {$?}} -\entry{-}{21}{\code {-}} -\entry{$-}{21}{\code {$-}} -\entry{$}{21}{\code {$}} -\entry{$$}{21}{\code {$$}} -\entry{!}{21}{\code {!}} -\entry{$!}{21}{\code {$!}} -\entry{0}{21}{\code {0}} -\entry{$0}{21}{\code {$0}} -\entry{_}{21}{\code {_}} -\entry{$_}{21}{\code {$_}} +\entry{-}{22}{\code {-}} +\entry{$-}{22}{\code {$-}} +\entry{$}{22}{\code {$}} +\entry{$$}{22}{\code {$$}} +\entry{!}{22}{\code {!}} +\entry{$!}{22}{\code {$!}} +\entry{0}{22}{\code {0}} +\entry{$0}{22}{\code {$0}} +\entry{_}{22}{\code {_}} +\entry{$_}{22}{\code {$_}} \entry{CDPATH}{72}{\code {CDPATH}} \entry{HOME}{72}{\code {HOME}} \entry{IFS}{72}{\code {IFS}} @@ -145,13 +145,13 @@ \entry{history-preserve-point}{112}{\code {history-preserve-point}} \entry{history-size}{112}{\code {history-size}} \entry{horizontal-scroll-mode}{112}{\code {horizontal-scroll-mode}} -\entry{input-meta}{112}{\code {input-meta}} -\entry{meta-flag}{112}{\code {meta-flag}} +\entry{input-meta}{113}{\code {input-meta}} +\entry{meta-flag}{113}{\code {meta-flag}} \entry{isearch-terminators}{113}{\code {isearch-terminators}} \entry{keymap}{113}{\code {keymap}} \entry{mark-modified-lines}{113}{\code {mark-modified-lines}} \entry{mark-symlinked-directories}{113}{\code {mark-symlinked-directories}} -\entry{match-hidden-files}{113}{\code {match-hidden-files}} +\entry{match-hidden-files}{114}{\code {match-hidden-files}} \entry{menu-complete-display-prefix}{114}{\code {menu-complete-display-prefix}} \entry{output-meta}{114}{\code {output-meta}} \entry{page-completions}{114}{\code {page-completions}} @@ -159,7 +159,7 @@ \entry{show-all-if-ambiguous}{114}{\code {show-all-if-ambiguous}} \entry{show-all-if-unmodified}{114}{\code {show-all-if-unmodified}} \entry{show-mode-in-prompt}{114}{\code {show-mode-in-prompt}} -\entry{skip-completed-text}{114}{\code {skip-completed-text}} +\entry{skip-completed-text}{115}{\code {skip-completed-text}} \entry{vi-cmd-mode-string}{115}{\code {vi-cmd-mode-string}} \entry{vi-ins-mode-string}{115}{\code {vi-ins-mode-string}} \entry{visible-stats}{115}{\code {visible-stats}} diff --git a/doc/bashref.vrs b/doc/bashref.vrs index 796798bf..69ac1114 100644 --- a/doc/bashref.vrs +++ b/doc/bashref.vrs @@ -1,30 +1,30 @@ \initial {!} -\entry {\code {!}}{21} +\entry {\code {!}}{22} \initial {#} \entry {\code {#}}{21} \initial {$} -\entry {\code {$}}{21} -\entry {\code {$!}}{21} +\entry {\code {$}}{22} +\entry {\code {$!}}{22} \entry {\code {$#}}{21} -\entry {\code {$$}}{21} +\entry {\code {$$}}{22} \entry {\code {$*}}{21} -\entry {\code {$-}}{21} +\entry {\code {$-}}{22} \entry {\code {$?}}{21} \entry {\code {$@}}{21} -\entry {\code {$_}}{21} -\entry {\code {$0}}{21} +\entry {\code {$_}}{22} +\entry {\code {$0}}{22} \initial {*} \entry {\code {*}}{21} \initial {-} -\entry {\code {-}}{21} +\entry {\code {-}}{22} \initial {?} \entry {\code {?}}{21} \initial {@} \entry {\code {@}}{21} \initial {_} -\entry {\code {_}}{21} +\entry {\code {_}}{22} \initial {0} -\entry {\code {0}}{21} +\entry {\code {0}}{22} \initial {A} \entry {\code {auto_resume}}{105} \initial {B} @@ -116,7 +116,7 @@ \initial {I} \entry {\code {IFS}}{72} \entry {\code {IGNOREEOF}}{80} -\entry {\code {input-meta}}{112} +\entry {\code {input-meta}}{113} \entry {\code {INPUTRC}}{80} \entry {\code {isearch-terminators}}{113} \initial {K} @@ -139,9 +139,9 @@ \entry {\code {MAPFILE}}{80} \entry {\code {mark-modified-lines}}{113} \entry {\code {mark-symlinked-directories}}{113} -\entry {\code {match-hidden-files}}{113} +\entry {\code {match-hidden-files}}{114} \entry {\code {menu-complete-display-prefix}}{114} -\entry {\code {meta-flag}}{112} +\entry {\code {meta-flag}}{113} \initial {O} \entry {\code {OLDPWD}}{81} \entry {\code {OPTARG}}{72} @@ -177,7 +177,7 @@ \entry {\code {show-all-if-ambiguous}}{114} \entry {\code {show-all-if-unmodified}}{114} \entry {\code {show-mode-in-prompt}}{114} -\entry {\code {skip-completed-text}}{114} +\entry {\code {skip-completed-text}}{115} \initial {T} \entry {\code {TEXTDOMAIN}}{7} \entry {\code {TEXTDOMAINDIR}}{7} diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi index 04dd4e82..4cdadc72 100644 --- a/lib/readline/doc/rluser.texi +++ b/lib/readline/doc/rluser.texi @@ -475,6 +475,7 @@ The default value is @samp{off}. If set to @samp{on}, and @var{completion-ignore-case} is enabled, Readline treats hyphens (@samp{-}) and underscores (@samp{_}) as equivalent when performing case-insensitive filename matching and completion. +The default value is @samp{off}. @item completion-prefix-display-length @vindex completion-prefix-display-length @@ -802,7 +803,7 @@ Meta-Rubout: backward-kill-word Control-o: "> output" @end example -In the above example, @kbd{C-u} is bound to the function +In the example above, @kbd{C-u} is bound to the function @code{universal-argument}, @kbd{M-DEL} is bound to the function @code{backward-kill-word}, and @kbd{C-o} is bound to run the macro @@ -2289,7 +2290,7 @@ _comp_cd() local cur _skipdot _cdpath local i j k - # Tilde expansion, with side effect of expanding tilde to full pathname + # Tilde expansion, which also expands tilde to full pathname case "$2" in \~*) eval cur="$2" ;; *) cur=$2 ;; diff --git a/lib/readline/histexpand.c b/lib/readline/histexpand.c index e9c333d7..34007796 100644 --- a/lib/readline/histexpand.c +++ b/lib/readline/histexpand.c @@ -1429,11 +1429,11 @@ history_tokenize_word (const char *string, int ind) } } - if (member (string[i], "<>;&|$")) + if (member (string[i], "<>;&|")) { int peek = string[i + 1]; - if (peek == string[i] && peek != '$') + if (peek == string[i]) { if (peek == '<' && string[i + 2] == '-') i++; @@ -1456,9 +1456,8 @@ history_tokenize_word (const char *string, int ind) i += 2; return i; } - /* XXX - separated out for later -- bash-4.2 */ - else if ((peek == '(' && (string[i] == '>' || string[i] == '<')) || /* ) */ - (peek == '(' && string[i] == '$')) /*)*/ + /* XXX - process substitution -- separated out for later -- bash-4.2 */ + else if (peek == '(' && (string[i] == '>' || string[i] == '<')) /*)*/ { i += 2; delimopen = '('; @@ -1466,34 +1465,9 @@ history_tokenize_word (const char *string, int ind) nestdelim = 1; goto get_word; } -#if 0 - else if (peek == '\'' && string[i] == '$') - { - i += 2; /* XXX */ - return i; - } -#endif - if (string[i] != '$') - { - i++; - return i; - } - } - - /* same code also used for $(...)/<(...)/>(...) above */ - if (member (string[i], "!@?+*")) - { - int peek = string[i + 1]; - - if (peek == '(') /*)*/ - { - /* Shell extended globbing patterns */ - i += 2; - delimopen = '('; - delimiter = ')'; /* XXX - not perfect */ - nestdelim = 1; - } + i++; + return i; } get_word: @@ -1538,6 +1512,16 @@ get_word: continue; } + /* Command and process substitution; shell extended globbing patterns */ + if (nestdelim == 0 && delimiter == 0 && member (string[i], "<>$!@?+*") && string[i+1] == '(') /*)*/ + { + i += 2; + delimopen = '('; + delimiter = ')'; + nestdelim = 1; + continue; + } + if (delimiter == 0 && (member (string[i], history_word_delimiters))) break; diff --git a/tests/histexp.right b/tests/histexp.right index bcf5dea6..11ed7330 100644 --- a/tests/histexp.right +++ b/tests/histexp.right @@ -203,3 +203,23 @@ d e ! ! ./histexp4.sub: line 20: !': event not found +/tmp/Step1 +echo /$(echo tmp)/Step1 +/tmp/Step1 +echo /<(echo tmp)/Step1 > /dev/null +/tmp/Step1 +echo $(echo /tmp)/Step1 +/tmp/Step1 +echo <(echo /tmp)/Step1 > /dev/null +/+(one|two|three)/Step1 +echo /+(one|two|three)/Step1 +/+(one|two|three)/Step1 +/*(tmp|dev|usr)/Step1 +echo /*(tmp|dev|usr)/Step1 +/*(tmp|dev|usr)/Step1 ++(/one|/two|/three)/Step1 +echo +(/one|/two|/three)/Step1 ++(/one|/two|/three)/Step1 +*(/tmp|/dev|/usr)/Step1 +echo *(/tmp|/dev|/usr)/Step1 +*(/tmp|/dev|/usr)/Step1 diff --git a/tests/histexp.tests b/tests/histexp.tests index 2901064f..22c90a76 100644 --- a/tests/histexp.tests +++ b/tests/histexp.tests @@ -140,3 +140,4 @@ ${THIS_SH} ./histexp1.sub ${THIS_SH} ./histexp2.sub ${THIS_SH} ./histexp3.sub ${THIS_SH} ./histexp4.sub +${THIS_SH} ./histexp5.sub diff --git a/tests/histexp5.sub b/tests/histexp5.sub new file mode 100644 index 00000000..0fe62fe4 --- /dev/null +++ b/tests/histexp5.sub @@ -0,0 +1,28 @@ +set -o history +set -o histexpand + +# command and process substitutions should be tokenized as a single word +echo /$(echo tmp)/Step1 +echo !:* +echo /<(echo tmp)/Step1 >/dev/null +echo !:* + +# same tests at the beginning of a word +echo $(echo /tmp)/Step1 +echo !:* +echo <(echo /tmp)/Step1 >/dev/null +echo !:* + +# so should shell extended glob patterns +shopt -s extglob + +echo /+(one|two|three)/Step1 +echo !:* +echo /*(tmp|dev|usr)/Step1 +echo !:* + +# same tests at the beginning of a word +echo +(/one|/two|/three)/Step1 +echo !:* +echo *(/tmp|/dev|/usr)/Step1 +echo !:* diff --git a/tests/posixexp.right b/tests/posixexp.right index 1e81eadb..53a08e3b 100644 --- a/tests/posixexp.right +++ b/tests/posixexp.right @@ -275,5 +275,9 @@ argv[2] = [ abc def ghi jkl / abc def ghi jkl ] [ abc def ghi jkl ] [ abc def ghi jkl / abc def ghi jkl / abc def ghi jkl ] -./posixexp.tests: line 82: unexpected EOF while looking for matching `}' -./posixexp.tests: line 83: syntax error: unexpected end of file +5: notOK +OK +OK +5: $'not\ttoo\nbad' +./posixexp.tests: line 83: unexpected EOF while looking for matching `}' +./posixexp.tests: line 84: syntax error: unexpected end of file diff --git a/tests/posixexp.tests b/tests/posixexp.tests index 76dfede9..3368711f 100644 --- a/tests/posixexp.tests +++ b/tests/posixexp.tests @@ -76,6 +76,7 @@ ${THIS_SH} ./posixexp3.sub ${THIS_SH} ./posixexp4.sub ${THIS_SH} ./posixexp5.sub ${THIS_SH} ./posixexp6.sub +${THIS_SH} ./posixexp7.sub # this will be an error foo=bar diff --git a/tests/posixexp7.sub b/tests/posixexp7.sub new file mode 100644 index 00000000..2e230cf8 --- /dev/null +++ b/tests/posixexp7.sub @@ -0,0 +1,13 @@ +# test the effect of quotes on the WORD in the posix pattern removal operators +# a here document does not behave the same as double quotes +x=notOK +cat < environment foo= +foo=foo environment foo=foo +foo=foo environment foo=foo a=z a=b a=z diff --git a/tests/varenv12.sub b/tests/varenv12.sub index 6aaf512b..edba3c94 100644 --- a/tests/varenv12.sub +++ b/tests/varenv12.sub @@ -47,6 +47,28 @@ echo -n 'outside: ' ; declare -p var unset -v var unset -f func +# this will probably change behavior; export shouldn't behave like this when +# not in posix mode and the sequencing is probably wrong in posix mode. since +# export is a special builtin, the variable assignment should modify the +# global variable, leaving the local variable unchanged. all shells, including +# bash, modify the local variable; bash is the only one that propagates the +# value out to the calling environment. bash does that only when in posix +# mode. + +func() +{ + local var=inside + var=value export var + echo -n 'inside: ' ; declare -p var +} + +var=outside +func +echo -n 'outside: ' ; declare -p var + +unset -v var +unset -f func + func() { local var=local @@ -60,3 +82,19 @@ echo -n 'outside: ' ; declare -p var unset -v var unset -f func + +# test whether or not temporary environment assignments are exported +# in posix mode +showfoo() +{ + printf %s "foo=${foo-}" + echo -n ' environment foo=' + printenv foo || echo +} +unset foo +showfoo +foo=foo showfoo +showfoo + +unset -v foo +unset -f showfoo