Module gnue.common.external.shellwords
shellwords.py
Parse a string into words like a (POSIX) shell does.
License: Python Software Foundation License
http://www.opensource.org/licenses/PythonSoftFoundation.html
This module parses a string into words according to the parings-rules
of a POSIX shell. These parsing rules are (quoted after 'man bash'):
1) Words are split at whitespace charakters; these are Space, Tab,
Newline, Carriage-Return, Vertival-Tab (0B) and Form-Feet (0C).
NB: Quotes do _not_ separate words! Thus
"My"Fancy"Computer"
will be parsed into a single word:
MyFancyComputer
2) A non-quoted backslash (\) is the escape character. It preserves
the literal value of the next character that follows.
3) Enclosing characters in single quotes preserves the literal value
of each character within the quotes. A single quote may not occur
between single quotes, even when preceded by a backslash.
This means: baskslash (\) has no special meaning within single
quotes. All charakters within single quotes are taken as-is.
4) Enclosing characters in double quotes preserves the literal value
of all characters within the quotes, with the exception of \. The
backslash retains its special meaning only when followed " or \. A
double quote may be quoted within double quotes by preceding it
with a backslash.
http://www.crazy-compilers.com/py-lib/#shellwords
| Function Summary |
| |
shellwords(line)
|