devd problem with 9-stable

Chuck Swiger cswiger at mac.com
Fri Jun 15 18:32:57 UTC 2012


On Jun 15, 2012, at 11:23 AM, Oliver Fromme wrote:
> You can try to prepend a backslash, i.e. echo \$devnum.  This
> isn't documented, but then again, using backslashes to continue
> strings that span multiple lines isn't documented either.

Line continuations and escaping special chars like $ are in "man sh":

"Backslash
     A backslash preserves the literal meaning of the following char-
     acter, with the exception of the newline character (`\n').  A
     backslash preceding a newline is treated as a line continuation."

The Bash manpage is perhaps more clear about this:

   There  are  three  quoting  mechanisms:  the  escape  character, single
   quotes, and double quotes.

   A non-quoted backslash (\) is the escape character.  It  preserves  the
   literal value of the next character that follows, with the exception of
   <newline>.  If a \<newline> pair appears,  and  the  backslash  is  not
   itself  quoted,  the \<newline> is treated as a line continuation (that
   is, it is removed from the input stream and effectively ignored).

   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.

   Enclosing characters in double quotes preserves the  literal  value  of
   all  characters  within the quotes, with the exception of $, `, \, and,
   when history expansion is enabled, !.  The characters $  and  `  retain
   their  special meaning within double quotes.  The backslash retains its
   special meaning only when followed by one of the following  characters:
   $,  `,  ", \, or <newline>.  A double quote may be quoted within double
   quotes by preceding it with a backslash.  If enabled, history expansion
   will  be  performed  unless an !  appearing in double quotes is escaped
   using a backslash.  The backslash preceding the !  is not removed.

Regards,
-- 
-Chuck



More information about the freebsd-stable mailing list