Shell quoting
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- Sep 15, 2005, 18:44 UTC
- Message-ID
- <4329C11A.1040302@zytor.com>
- In-Reply-To
- <7vy85yahjk.fsf@assigned-by-dhcp.cox.net>
Okay, I'm trying to put together some rules that should work across shells.
For byte values:
0 Hopeless - not representable in C strings 1-31,127 Prefix with ^V if (and only if!) entered at a prompt, as opposed to passed in the ssh command field 32-126 \-escape all characters except -+_@=:.,/ and ASCII alphanumerics 128- Don't escape (would have to be done differently depending on locale, and shouldn't be needed)
Anyone know of a system for which that breaks horribly? The 1-31,127 stuff is iffy, but I just don't know of anything that's more reliable. Unfortunately \010-style quoting doesn't work in any of the common shells.
-hpa