diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-24 21:12:33 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-10-24 21:12:33 +0200 |
commit | db74c6caedf752623820cd09f7fbeaf4152e1de8 (patch) | |
tree | c571da864f785eb3025201989a45375267591e19 | |
parent | 61d5997b586a28f79d54b28ce6963b643dff6e9e (diff) | |
download | busybox-w32-db74c6caedf752623820cd09f7fbeaf4152e1de8.tar.gz busybox-w32-db74c6caedf752623820cd09f7fbeaf4152e1de8.tar.bz2 busybox-w32-db74c6caedf752623820cd09f7fbeaf4152e1de8.zip |
ash: explain EXP_REDIR and why we (dont) glob redir filenames
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index c9d39b875..d9595bb8f 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -5545,6 +5545,17 @@ ash_arith(const char *s) | |||
5545 | #define EXP_TILDE 0x2 /* do normal tilde expansion */ | 5545 | #define EXP_TILDE 0x2 /* do normal tilde expansion */ |
5546 | #define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ | 5546 | #define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ |
5547 | #define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ | 5547 | #define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ |
5548 | /* ^^^^^^^^^^^^^^ this is meant to support constructs such as "cmd >file*.txt" | ||
5549 | * POSIX says for this case: | ||
5550 | * Pathname expansion shall not be performed on the word by a | ||
5551 | * non-interactive shell; an interactive shell may perform it, but shall | ||
5552 | * do so only when the expansion would result in one word. | ||
5553 | * Currently, our code complies to the above rule by never globbing | ||
5554 | * redirection filenames. | ||
5555 | * Bash performs globbing, unless it is non-interactive and in POSIX mode. | ||
5556 | * (this means that on a typical Linux distro, bash almost always | ||
5557 | * performs globbing, and thus diverges from what we do). | ||
5558 | */ | ||
5548 | #define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ | 5559 | #define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ |
5549 | #define EXP_QPAT 0x20 /* pattern in quoted parameter expansion */ | 5560 | #define EXP_QPAT 0x20 /* pattern in quoted parameter expansion */ |
5550 | #define EXP_VARTILDE2 0x40 /* expand tildes after colons only */ | 5561 | #define EXP_VARTILDE2 0x40 /* expand tildes after colons only */ |