[Gllug] Changing case on filenames
Mike Brodbelt
mike at coruscant.demon.co.uk
Tue Mar 5 00:47:41 UTC 2002
On Mon, 2002-03-04 at 21:58, Rob Andrews wrote:
> [04-Mar-2002 21:36.23 (GMT) / Gordon Joly]
> > >This wonderful technique can be built on:-
> > >for i in *; do
> > >mv $i `echo $i | tr 'A-Z' 'n-za-m'`
> > >done
> > which shell?
>
> My suspicion tells me that won't work, since $ will be quoted directly due
> to the single quotes.
Your suspicions are unfounded :-). It works, exactly as above, in bash:-
$ touch FRED BILL MARY
$ for i in *; do
> mv $i `echo $i | tr 'A-Z' 'n-za-m'`
> done
$ ls
ovyy serq znel
$
GNU bash, version 1.14.7(1)
> Additionally, the internal single quotes are unescaped, so they'll break.
Why would they need escaping? GNU tr is actually equally happy without
them there at all (and so is happy with what the shell feeds it).
Mike.
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list