[NTLUG:Discuss] Script question
Rick Matthews
Rick at Matthews.net
Fri Jan 4 08:18:17 CST 2002
Would someone please help me over another "hump"? I'm still learning...
I maintain the current version and 3 previous versions of the file
"domains". The files are all in the same directory and the file name
includes a unique date/time stamp and a version number. For example:
domains.2002-01-04_050500.0
domains.2002-01-02_052515.1
domains.2002-01-01_043025.2
domains.2001-12-30_050500.3
'0' is the current version and '3' is the oldest.
When a new file is created I want to "age" the files and create an open
slot for a new "0" file (3 goes away, 2 becomes 3, 1 becomes 2, and 0
becomes 1). I don't know the date/time stamps, so this is what I tried
in my script:
mv -f /archive/domains.*.2 /archive/domains.*.3
mv -f /archive/domains.*.1 /archive/domains.*.2
mv -f /archive/domains.*.0 /archive/domains.*.1
The asterisk apparently acts as a wildcard during the file selection
part of the command, but it is acting as a literal in the renaming
porting of the command (I end up with files named domains.*.3).
How can I rewrite this to accomplish the task?
Thanks in advance!
Rick Matthews
More information about the Discuss
mailing list