Message148410
| Author |
robodan |
| Recipients |
eric.araujo, eric.smith, niemeyer, robodan |
| Date |
2011年11月26日.14:40:23 |
| SpamBayes Score |
4.283451e-08 |
| Marked as misclassified |
No |
| Message-id |
<CAEcGQ+OB1ftaDtpEF+A-SQhw-JTYnUomyWW1zhUSzi+iAU5R4w@mail.gmail.com> |
| In-reply-to |
<1322316775.16.0.470249070612.issue1521950@psf.upfronthosting.co.za> |
| Content |
On Sat, Nov 26, 2011 at 7:12 AM, Éric Araujo <report@bugs.python.org> wrote:
> Your script passes with dash, which is probably the most POSIX-compliant shell we can find. (bash has extensions, zsh/csh don’t use the POSIX shell language, so I think the behavior of dash should be our reference, not the bash man page.)
I was just looking for a reference where I didn't have to sift through
tons of documentation. Most systems have bash. Before that I was
just working from experience (I've done a lot of shell scripting).
> there is code out there that depends on the current behavior of shlex and does not need to support && || ; ( ), if we add support for these tokens we should not break the existing code.
Here's a thought on how that might work (just brainstorming). shlex
uses a series of character strings to drive it's parsing: whitespace,
escape, quotes. Add another one: control = '();<>|&'. If it is unset
(by default?), then the behavior is as before. If it is set, then
shlex will output any character in control as a separate token.
There might be a shell specific script (or maybe it's left to the
user) that decides that certain tokens can be recombined: '&&', '||',
'|&', '>>', etc. This code is pretty simple: walk the token
sequence, if you see a two token pair, pop the second and combine it
into the first.
-Dan |
|