Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Multiline Anonymous Literal Strings




On Sep 28, 2006, at 1:51 PM, Chris Johnson wrote:

Hi.

Anyone know of a way to compose a long literal string without doing
something like this?

   myvar="this is a really long string so long that I need to break"
   myvar="$myvar up the assignment"

In C, contiguous quoted strings are implicitly joined at a compile time:

   printf("This is a really long literal strong that will extend "
          "beyond 80 characters.\n");

In Perl and other languages, concatenation operators like ., &, and +
are available.

One application of this problem's

You can try:

foo="some text on this line \
more text here \
yet more here"

the \'s keep everything on one line, i.e. the newlines aren't part of the string.

Mike



Messages sorted by: Reverse Date, Date, Thread, Author