[NTLUG:Discuss] Script question
Steve Baker
sjbaker1 at airmail.net
Fri Jan 4 21:19:18 CST 2002
Bob Byron wrote:
>
> You might give something like this a try:
> rm domains.*.3
> filename=`ls domains.*.2 | cut -d '.' -f 1-2`
> mv ${filename}.2 ${filename}.3
It would be simpler & safer (I think) to do this:
rm domains.*.3
mv domains.*.2 `basename domains.*.2 .2`.3
mv domains.*.1 `basename domains.*.1 .1`.2
The basename command removes the extension specified in the second
argument from the filename mentioned in the first argument.
Personally, I'd have structured the problem a little differently
and placed the backup copies into subdirectories named '.1', '.2' and '.3'
so I could say:
rm .3/*
mv .2/* .3
mv .1/* .2
...that's elegant because you can have as many files as you like backed
up in each directory and the 'aging' process happens in lockstep for all
of them.
----------------------------- Steve Baker -------------------------------
Mail : <sjbaker1 at airmail.net> WorkMail: <sjbaker at link.com>
URLs : http://www.sjbaker.org
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://prettypoly.sf.net http://freeglut.sf.net
http://toobular.sf.net http://lodestone.sf.net
More information about the Discuss
mailing list