#545: Use ssh ProxyCommand instead of multiple ssh commands --------------------------+------------------------------------------------- Reporter: eschnett | Owner: eschnett Type: enhancement | Status: review Priority: major | Milestone: Component: SimFactory | Version: Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by eschnett):
Quoting is independent of the shell. It is also rather simple, because a shell does not interpret any characters as special within single quotes. The only thing left to do is to quote single quotes themselves; this can be done either by prepending a backslash, or by enclosing it in double quotes. Both become impossible to decipher if there are more than two levels of quoting.
One also needs to know that there needs to be an unquoted space to separate arguments. For example,
Hello' 'World
is a single argument. So, to quote in a single-quote-delimited string, one first has to end the string (single quote), then add a quoted quote (backslash - single quote), then begin the string again (single quote).
The general quoting rule is: 1. replace any single quote by ''' (single quote - backslash - single quote - single quote) 2. surround the string by single quotes
We could us a shellquote module for this, but the corresponding Python function is just two lines long, so this may be overkill.