bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating unique file names


From: Paul Jarc
Subject: Re: Generating unique file names
Date: Sun, 13 May 2007 21:53:30 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux)

matte <mattes.id@gmail.com> wrote:
>    The count would be sufficient, as each folder will always hold ONLY these
>    archives, and no hidden files.
>    Thus, my directory would be:
>    myArcName_1.tar.gz
>    myArcName_2.tar.gz
>    myArcName_3.tar.gz

This will do it, starting the numbering at 0:
set myArcName_[*].tar.gz myArcName_*.tar.gz
if test "$1" = 'myArcName_[*].tar.gz'
   test "$2" = 'myArcName_*.tar.gz'
  then shift
fi
newname=myArcName_$#.tar.gz

If you can assume there are already some files present, numbered from
0, then you can simplify it:
set myArcName_*.tar.gz
newname=myArcName_$#.tar.gz


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]