[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Using single quotes to escape a newline
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Using single quotes to escape a newline |
Date: |
Wed, 1 Jul 2015 10:42:36 -0400 |
User-agent: |
Mutt/1.4.2.3i |
> On Wed, Jul 1, 2015 at 7:33 AM, Greg Wooledge <address@hidden> wrote:
> > On Wed, Jul 01, 2015 at 07:21:46AM -0700, Michael Convey wrote:
> > > Has the ability of single quotes to escape a newline changed since this
> > > book was written?
> >
> > No. The book was simply wrong.
> >
On Wed, Jul 01, 2015 at 07:36:05AM -0700, Michael Convey wrote:
> Thanks. Is a backslash the only way to escape a newline?
That depends on what you're trying to do. If you simply want to
create a list of words, formatted nicely within the source code, but
appearing as a horizontal string in the output, I wouldn't even
*create* a scalar string variable. I'd store them in an array, and
create the "big horizontal string with spaces in it" with a command.
For instance:
words=(
these
are
my
words # and you can even have comments!
)
echo "${words[*]}"
Re: [Help-bash] Using single quotes to escape a newline, Stephane Chazelas, 2015/07/01