[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Using single quotes to escape a newline

From: Stephane Chazelas
Subject: Re: [Help-bash] Using single quotes to escape a newline
Date: Wed, 1 Jul 2015 16:01:43 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2015-07-01 07:36:05 -0700, Michael Convey:
> Thanks. Is a backslash the only way to escape a newline?

Backslash doesn't escape the newline, it removes it (including
inside double quotes).

To escape/quote a newline, as in to remove its special meaning,
like you would escape ";", "&" or "|" (other command delimiters)
or space/tab (word delimiters) etc, it's only double quotes and
single quotes.

newline is different from other special characters there in that
\ does not escape it. The \<newline> sequence is used as
line-continuation. That's to be able to continue a "logical"
line onto the next "physical" line, either to make the code more
legible like in:

  cmd --opt1 fop \
      --opt2 bar \
      $(long command...) \
      other arguments

Or because of the limitation on physical lines (like on old
terminals that don't support line wrapping) or because of limits
imposed on text files by some other tools...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]