Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Upper case
- X-seq: zsh-users 2703
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: Upper case
- Date: Tue, 26 Oct 1999 15:51:45 +0200 (MET DST)
- In-reply-to: Andrei Zmievski's message of Tue, 26 Oct 1999 08:34:09 -0500
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
Andrei Zmievski wrote:
> On Mon, 25 Oct 1999, Geoff Wing wrote:
> > One way:
> > mv $i ${${(C)i}:s/Mp3/mp3/}
>
> Could someone explain this one to me, piece by piece? Obviously,
> s/Mp3/mp3 does a substitution but what is ${${(C)i}} all about?
It's quite simple, actually. In `${name}' substitutions, the `name'
may also be another substitution. The outer one will then work on the
result of the inner one (of course they can be nested as deeply as you
want). So the `${(C)i}' is a parameter substitution with a flag, the
`(C)'. Such flags not supported by other shells, so I think this is
what really irritates you. Zsh has several such flags, some are
rather baroque, but many are quite useful, see the `Parameter
Expansion' section in the docs (in the `zshexpn.1' man page if you use
the manual). Sorry, there are too many flags to explain all of them
here.
Anyway, the `${(C)i}' yields the contents of the parameter `i'
capitalized. This string is then used by the `${...:s/Mp3/mp3}' which
just replaces every `Mp3' with `mp3', of course.
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author