aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-04-10 15:25:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-04-10 15:25:41 +0200
commit3632cb15f16a7596a68dccfd66a2ad9496bf9fd9 (patch)
treeb1725852f1437a684c87e082ca20190819d2ddc6
parent4709df0f152c477c191f83e18bfecabb2fb2c1f9 (diff)
downloadbusybox-w32-3632cb15f16a7596a68dccfd66a2ad9496bf9fd9.tar.gz
busybox-w32-3632cb15f16a7596a68dccfd66a2ad9496bf9fd9.tar.bz2
busybox-w32-3632cb15f16a7596a68dccfd66a2ad9496bf9fd9.zip
shell: add comments about [[, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/test.c4
-rw-r--r--shell/ash.c15
-rw-r--r--shell/hush.c12
3 files changed, 30 insertions, 1 deletions
diff --git a/coreutils/test.c b/coreutils/test.c
index 824ce3b5a..ddb66ddce 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -313,6 +313,9 @@ static const struct operator_t ops_table[] = {
313 { /* "-L" */ FILSYM , UNOP }, 313 { /* "-L" */ FILSYM , UNOP },
314 { /* "-S" */ FILSOCK , UNOP }, 314 { /* "-S" */ FILSOCK , UNOP },
315 { /* "=" */ STREQ , BINOP }, 315 { /* "=" */ STREQ , BINOP },
316 /* "==" is bashism, http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
317 * lists only "=" as comparison operator.
318 */
316 { /* "==" */ STREQ , BINOP }, 319 { /* "==" */ STREQ , BINOP },
317 { /* "!=" */ STRNE , BINOP }, 320 { /* "!=" */ STRNE , BINOP },
318 { /* "<" */ STRLT , BINOP }, 321 { /* "<" */ STRLT , BINOP },
@@ -357,6 +360,7 @@ static const char ops_texts[] ALIGN1 =
357 "-L" "\0" 360 "-L" "\0"
358 "-S" "\0" 361 "-S" "\0"
359 "=" "\0" 362 "=" "\0"
363 /* "==" is bashism */
360 "==" "\0" 364 "==" "\0"
361 "!=" "\0" 365 "!=" "\0"
362 "<" "\0" 366 "<" "\0"
diff --git a/shell/ash.c b/shell/ash.c
index 45c747dbc..713219b6e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -197,7 +197,20 @@
197#define IF_BASH_PATTERN_SUBST IF_ASH_BASH_COMPAT 197#define IF_BASH_PATTERN_SUBST IF_ASH_BASH_COMPAT
198#define BASH_SUBSTR ENABLE_ASH_BASH_COMPAT 198#define BASH_SUBSTR ENABLE_ASH_BASH_COMPAT
199#define IF_BASH_SUBSTR IF_ASH_BASH_COMPAT 199#define IF_BASH_SUBSTR IF_ASH_BASH_COMPAT
200/* [[ EXPR ]] */ 200/* BASH_TEST2: [[ EXPR ]]
201 * Status of [[ support:
202 * We replace && and || with -a and -o
203 * TODO:
204 * singleword+noglob expansion:
205 * v='a b'; [[ $v = 'a b' ]]; echo 0:$?
206 * [[ /bin/* ]]; echo 0:$?
207 * -a/-o are not AND/OR ops! (they are just strings)
208 * quoting needs to be considered (-f is an operator, "-f" and ""-f are not; etc)
209 * = is glob match operator, not equality operator: STR = GLOB
210 * (in GLOB, quoting is significant on char-by-char basis: a*cd"*")
211 * == same as =
212 * add =~ regex match operator: STR =~ REGEX
213 */
201#define BASH_TEST2 (ENABLE_ASH_BASH_COMPAT * ENABLE_ASH_TEST) 214#define BASH_TEST2 (ENABLE_ASH_BASH_COMPAT * ENABLE_ASH_TEST)
202#define BASH_SOURCE ENABLE_ASH_BASH_COMPAT 215#define BASH_SOURCE ENABLE_ASH_BASH_COMPAT
203#define BASH_PIPEFAIL ENABLE_ASH_BASH_COMPAT 216#define BASH_PIPEFAIL ENABLE_ASH_BASH_COMPAT
diff --git a/shell/hush.c b/shell/hush.c
index 98ba96e0c..3afb70cb0 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -79,6 +79,18 @@
79 * Some builtins mandated by standards: 79 * Some builtins mandated by standards:
80 * newgrp [GRP]: not a builtin in bash but a suid binary 80 * newgrp [GRP]: not a builtin in bash but a suid binary
81 * which spawns a new shell with new group ID 81 * which spawns a new shell with new group ID
82 *
83 * Status of [[ support:
84 * [[ args ]] are CMD_SINGLEWORD_NOGLOB:
85 * v='a b'; [[ $v = 'a b' ]]; echo 0:$?
86 * [[ /bin/* ]]; echo 0:$?
87 * TODO:
88 * &&/|| are AND/OR ops, -a/-o are not
89 * quoting needs to be considered (-f is an operator, "-f" and ""-f are not; etc)
90 * = is glob match operator, not equality operator: STR = GLOB
91 * (in GLOB, quoting is significant on char-by-char basis: a*cd"*")
92 * == same as =
93 * add =~ regex match operator: STR =~ REGEX
82 */ 94 */
83//config:config HUSH 95//config:config HUSH
84//config: bool "hush (64 kb)" 96//config: bool "hush (64 kb)"