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

Re: Multiline Anonymous Literal Strings



Bart Schaefer sent me the following 1.1K:

> } Anyone know of a way to compose a long literal string without doing
> } something like this?
> 
> The following requires "setopt multios" (which is the default, but a
> few people turn it off):
> 
> alias mycommand=${(j: :)"${(f)$(<<<'print this is one string'
> # This is a comment, but you cannot use unbalanced quotes in it
> <<<'this is a more "     " spacey "     " string'
> <<<'this is a third string')}"}

Thanks.  I was trying to develop something like this with the (j::), but
didn't know how to get the anonymous array.

> } In Perl and other languages, concatenation operators like ., &, and +
> } are available.
> 
> And your point is?
> 
> The syntax of the shell language (which is only implemented by zsh, not
> defined by it) precludes the use of infix operators.

The ability to set literal operands apart with whitespace is also
precluded by simple juxtaposition-based concatenation.

The thought just occurred to me that I could write a function which
concatenates its arguments.  I'll give that a try.

-- 
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson



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