From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8959 invoked from network); 26 Oct 1999 13:52:35 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Oct 1999 13:52:35 -0000 Received: (qmail 22241 invoked by alias); 26 Oct 1999 13:52:00 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2703 Received: (qmail 22234 invoked from network); 26 Oct 1999 13:51:59 -0000 Date: Tue, 26 Oct 1999 15:51:45 +0200 (MET DST) Message-Id: <199910261351.PAA13671@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-users@sunsite.auc.dk In-reply-to: Andrei Zmievski's message of Tue, 26 Oct 1999 08:34:09 -0500 Subject: Re: Upper case 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@informatik.hu-berlin.de