Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: renaming with number prefix
- X-seq: zsh-users 1286
- From: nirva@xxxxxxxxxxxxxxxxx
- To: schaefer@xxxxxxxxxxxxxxxx (Bart Schaefer)
- Subject: Re: renaming with number prefix
- Date: Tue, 27 Jan 1998 20:21:27 -0500 (EST)
- Cc: guckes@xxxxxxxxxxxxxxxxx, zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <980123091904.ZM16897@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Jan 23, 98 09:19:04 am"
Bart Schaefer stands accused of saying:
> On Jan 23, 4:54pm, Sven Guckes wrote:
> } Subject: renaming with number prefix
> }
> } $ ls
> } abc bar baz foo zyxxy
> } $ <command>
> } $ ls
> } 1.abc 2.bar 3.baz 4.foo 5.zyxxy
> }
> } So - what's that <command>?
>
> integer i=0; for f in *; do mv $f $[i+=1].$f; done
>
> } Btw, "leading zeroes" would be a bonus.
>
> How many leading zeros? I'm guessing 3 digits total would be OK:
>
> typeset -Z 3 i=1 ; for f in *; do echo $f $i.$f; ((++i)); done
>
> Too bad $[i+=1] doesn't respect the typeset flags of `i' when printing.
typeset -Z 3 i=1 ; for f in *; do echo $f $i.$f; typeset -Z 3 i=$((++i)); done
---------------------------------------------------------------------------
Danny Dulai Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/ nirva@xxxxxxxxxxx
---------------------------------------------------------------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author