From: "Andrej Borsenkow" <borsenkow.msk@sni.de>
To: "Andrej Borsenkow" <borsenkow.msk@sni.de>,
"Peter Stephenson" <pws@ibmth.df.unipi.it>,
"Zsh hackers list" <zsh-workers@sunsite.auc.dk>
Subject: Corection RE: Final touch? RE: PATCH: more substitution documentation
Date: Thu, 18 Mar 1999 18:57:42 +0300 [thread overview]
Message-ID: <004601be7158$0e8b1810$21c9ca95@mowp.siemens.ru> (raw)
>
> So, the whole for a ${(flags)var-mods} looks like
>
> 1. take the value of var. The result is list (array) of words
> (may be empty or having only one element)
> 2. If this is quoted and no (@) is present, join the list with
> the first character if IFS (I think, it is correct? Not always
> with space?) thus producing a single word (again, actually a list
> with single word)
> 3. apply mods separately for every word in list
> 4. join the words again if (j) is present
> 5. split using (s) or $= if present
> 6. If no $= or (s) is present and the whole is not quoted, apply
> SH_WORD_SPLIT:
> 7. the result is again a (possibly empty) list of words. If the
> whole is not quoted, the empty words are removed
>
Correction for 2 and 4:
2. If this is quoted and no (@) or (j) is present, join words with first
character of IFS (tested); else if quoted and (j), but not (@), is present,
join with given string. It seems, that only the last (j) (and probably (s))
is used
4. - if quoted and both (j) and (@) are present or not quoted, join with
given string
itsrm2% IFS=:
itsrm2% foo=(a b)
itsrm2% args $foo
2
a
b
itsrm2% args "$foo"
1
a:b
itsrm2% args "${(j/x/)foo}"
1
axb
itsrm2% args "${(j/x/j/y/)foo}"
1
ayb
4. - if quoted and both (j) and (@) are present or not quoted, join with
given string
itsrm2% foo=(a1 b1)
itsrm2% args "${(@j/x/)foo%1*}"
1
axb
itsrm2% args "${(j/x/)foo%1*}"
1
a1xb
itsrm2% args ${(j/x/)foo%1*}
1
axb
I would not call it very consistent (but, well, it mostly the same as used
with splitting), but as long as you know the rules ... :-)
cheers
/andrej
reply other threads:[~1999-03-18 16:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='004601be7158$0e8b1810$21c9ca95@mowp.siemens.ru' \
--to=borsenkow.msk@sni.de \
--cc=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.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).