zsh-users
 help / color / mirror / code / Atom feed
From: sergio <sergio@outerface.net>
To: zsh-users@zsh.org
Subject: Re: join a string with a parameter value if it's not empy
Date: Sat, 4 Feb 2023 06:01:27 +0400	[thread overview]
Message-ID: <f7dce72b-274e-b754-8e1c-7bc92e822479@outerface.net> (raw)
In-Reply-To: <6e1b26963200efd1c6e7ed9a0dd976ded1ab72c9@hey.com>

On 04/02/2023 04:20, Eric Nielsen wrote:

> $p${p:+_}string

Nice!

Really I thought about the second way simplification, when I ask this 
question (:

It's more common, as it allows to join several parts.

tmp=($p 'string' whatever else)
${(j.#.)tmp}

Is it possible to construct an array without a tmp parameter? Without 
splitting.

-- 
sergio.


  reply	other threads:[~2023-02-04  2:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 23:43 sergio
2023-02-04  0:20 ` Eric Nielsen
2023-02-04  2:01   ` sergio [this message]
2023-02-04  3:30     ` Eric Nielsen
2023-02-04  4:03     ` Bart Schaefer
2023-02-04  8:39       ` Stephane Chazelas
2023-02-04  0:23 ` Eric Nielsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7dce72b-274e-b754-8e1c-7bc92e822479@outerface.net \
    --to=sergio@outerface.net \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).