zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: <zsh-users@sunsite.dk>
Subject: Re: Parameter expansion flags question
Date: Fri, 12 May 2006 07:45:15 -0700	[thread overview]
Message-ID: <060512074515.ZM15613@torch.brasslantern.com> (raw)
In-Reply-To: <DD74FBB8EE28D441903D56487861CD9D097172A4@lonpexch01.citrite.net>

On May 12, 12:02pm, John Cooper wrote:
} Subject: RE: Parameter expansion flags question
}
}   > Placement of the quotes is important:
}   >    for site in ${(f)"$($SITEMGR -i)":#}
} 
} OK, changing the placement of the quotes to the above fixes it. There's
} just one thing I'm a little puzzled about - in the case where $SITEMGR
} produces no output, won't "$($SITEMGR -i)" be the empty string? If so,
} why is :# needed? It seems it will just replace an empty string with
} another empty string?

It's the same as the difference between

string=""
array=( word "$string" word )
print $#array

and

string=""
array=( word $string word )
print $#array

An unquoted empty string is discarded; a quoted empty string is retained.
Effectively the :# construct discards the quoted empty string, leaving an
unquoted one in its place, which the shell in turn discards when building
the final array.


  reply	other threads:[~2006-05-12 14:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-12 11:02 John Cooper
2006-05-12 14:45 ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-15  9:01 John Cooper
2006-05-11  9:59 John Cooper
2006-05-11 16:38 ` Bart Schaefer
2006-05-10  9:22 John Cooper
2006-05-10 17:28 ` Bart Schaefer

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=060512074515.ZM15613@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /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).