From owner-freebsd-questions Fri Jul 23 13: 5:57 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dt011n65.san.rr.com (dt011n65.san.rr.com [204.210.13.101]) by hub.freebsd.org (Postfix) with ESMTP id BB30E14D6F for ; Fri, 23 Jul 1999 13:05:54 -0700 (PDT) (envelope-from Doug@gorean.org) Received: from localhost (doug@localhost) by dt011n65.san.rr.com (8.8.8/8.8.8) with ESMTP id NAA27444; Fri, 23 Jul 1999 13:02:41 -0700 (PDT) (envelope-from Doug@gorean.org) Date: Fri, 23 Jul 1999 13:02:41 -0700 (PDT) From: Doug X-Sender: doug@dt011n65.san.rr.com To: Brendan Kosowski Cc: FreeBSD Questions Subject: Re: bash question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 24 Jul 1999, Brendan Kosowski wrote: > Is there a special character I can use in filenames to tell bash to > automatically increment a number within the filename when redirecting data > to the file. No. > eg. The first time I type "date > [filename]" I want bash to place the > date in a filename called date.001 > > Now, because date.001 already exists, the next time I type the same > command it should produce date.002, and so on.... I had to solve a similar problem with a perl script that I use to do a trashcan type deletion routine. Here's what I came up with in pseudo-code. All of these things are possible to do with bash scripting too. Good luck, Doug -- On account of being a democracy and run by the people, we are the only nation in the world that has to keep a government four years, no matter what it does. -- Will Rogers Does date.nnn exist? If yes split number off the end increment number new filename is date + new number If no new filename is date + 001 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message