Another example of why Bourne shell quoting makes me grumpyFollowing up the previous case, here's something we ran into recently. Imagine that you want to pull lines out of So what do you have to write? It turns out that you need this:
You might innocently expect that you can write the sed expression just
as you would on the command line, as ' (And you have to be able to escape backquotes because otherwise you
couldn't nest backquote expansions. Eliminating this problem is why modern
versions of the Bourne shell allow you to write Any time you have multiple levels of escaping and de-escaping at work, you have entered into a land of pain. People are not good at counting escapes, or at keeping track of what each level of processing will do and what the results will look like, or even at remembering when quoting is and isn't needed. Making them do it anyways results in bugs, voodoo programming (add escapes until the code magically starts working), and often security bugs. And this is why I get grumpy about any language that requires multiple levels of escaping and de-escaping, the Bourne shell included. (I more or less permanently soured on TCL after similar experiences with an early version, although I've heard that current versions have fixed this.) |
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |