[klibc] [PATCH] Escape DHCP options written to /tmp/net-$DEVCICE.conf

Ulrich Dangel uli at spamt.net
Thu Apr 21 07:39:35 PDT 2011


* maximilian attems wrote [21.04.11 16:05]:
Hi,
> "There is actually a much better way to escape shell variables, a trick I
> learned from git: Always start with a single quote ('), then leave all
> characters except ' and ! unchanged.  For those two characters, emit the
> sequence '\'' or '\!' Including the single quotes" -hpa
 
Why escape !? There is AFAIK no history expansion within single quotes.

,----[man bash]
| 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  pre‐ ceded by a backslash.
`----

,----[man dash]
| Single Quotes
|  Enclosing characters in single quotes preserves the literal meaning of all
|  the  characters (except single quotes, making it impossible to put
|  single-quotes in  a single-quoted string).
`----

> do you care to respin?

Yes, sure. The single quote was actually my first implementation but I did not
escape ' correctly, so i changed it.

Ulrich
-- 
twitter: @mr_ud  | identica: @mru
IRCNet:  mru     | freenode: mrud



More information about the klibc mailing list