[NTLUG:Discuss] Script question: give me the next sequential filename....
Eric Schnoebelen
eric at cirr.com
Mon Mar 31 12:35:28 CST 2003
"Jack Snodgrass" writes:
- I need to create a log. It needs to be called
- makefile.yymmdd-x where
- makefile.yymmdd can be done with something like
- makefile.`date +DATE: '%y%m%d`
-
- ...now the catch... the first time I run this today, I want
- makefile.030331-1
- the next time I want
- makefile.030331-2
- and then
- makefile.030331-3
- etc.
-
- Is there a simple way to do this from bash or csh.
For SH derived shells:
x=0
do
x=`expr $x + 1`
fn="$pattern-$x"
while [ -f $fn ]
--
Eric Schnoebelen eric at cirr.com http://www.cirr.com
An expert is somebody who is more than 50 miles from home,
has no responsibility for implementing the advice he gives,
and shows slides. -- Edwin Meese
More information about the Discuss
mailing list