Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Creating a directory with a date-based name

zzapper wrote:
> Hi Ya,
> I'm a zsh newbie.
> I have the following bash script, which will create a directory say
> 06Dec03 if this directoryy exists then create 06Dec03v2
> I need to enhance it to create 06Dec03v3,4,5,6 etc. should these
> directories exist.
> How would this best be done in zsh?

integer vers=2

while [[ -d ${dat}v$vers ]]; do
   (( ++vers ))
mkdir ${dat}v$vers

(actually the same in bash, as far as I can see.)

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


Messages sorted by: Reverse Date, Date, Thread, Author