Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jun 2012 11:32:46 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Oliver Fromme <olli@lurza.secnetix.de>
Cc:        freebsd-stable List <freebsd-stable@FreeBSD.ORG>
Subject:   Re: devd problem with 9-stable
Message-ID:  <8F30E6C0-0FDB-46D2-9E2F-3A909B8B6182@mac.com>
In-Reply-To: <201206151823.q5FINRFT084093@lurza.secnetix.de>
References:  <201206151823.q5FINRFT084093@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F30E6C0-0FDB-46D2-9E2F-3A909B8B6182>