zsh-users
 help / color / mirror / code / Atom feed
From: Nikolai Weibull <now@bitwi.se>
To: Zsh Users <zsh-users@zsh.org>
Subject: Avoiding empty element when splitting NUL-separated string from command substitution
Date: Tue, 16 Aug 2011 14:13:58 +0200	[thread overview]
Message-ID: <CADdV=Mt4_iSEqxK4uCQTgD=3OoshuXOZcdUPRZgwZJy2jjbCbQ@mail.gmail.com> (raw)

% b=(${(0)"$(print -n)"})
% echo $#b
1

How do I avoid b containing an empty element in this case?  That is,
when the command substitution generated no output.

(The $(print -n) is, obviously, just an example.  It can be the
equivalent of, for example, $(print -n $'a\0\b\0c) as well.)


             reply	other threads:[~2011-08-16 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 12:13 Nikolai Weibull [this message]
2011-08-16 12:51 ` Peter Stephenson
2011-08-16 14:06   ` Nikolai Weibull
2011-08-16 14:53   ` Peter Stephenson

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='CADdV=Mt4_iSEqxK4uCQTgD=3OoshuXOZcdUPRZgwZJy2jjbCbQ@mail.gmail.com' \
    --to=now@bitwi.se \
    --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).