Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: renaming with number prefix
- X-seq: zsh-users 1265
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Guckes <guckes@xxxxxxxxxxxxxxxxx>, ZShell Users <zsh-users@xxxxxxxxxxxxxxx>
- Subject: Re: renaming with number prefix
- Date: Fri, 23 Jan 1998 09:19:04 -0800
- In-reply-to: <19980123165404.53612@xxxxxxxxxxxxxxxxx>
- References: <19980123165404.53612@xxxxxxxxxxxxxxxxx>
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.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author