TIP: Click on subject to list as thread! ANSI
echo: mbse
to: Vince Coen
from: Paul Quinn
date: 2003-12-08 16:19:00
subject: Help with a script

Hi! Vince,

In a message to All you wrote:

 VC> Can anyone solve a small problem for me?
 VC> In a script I need to create a command with two date blocks, ie,
 VC> foo -a startdate-enddate  param3 param4
 VC> with date block in the form ccyymmdd
 VC> Eg:
 VC> foo -a 20031101-20031130 param3 param4
 VC> I need to run this on the 1st of each month so the script needs to
 VC> do:

 VC> 1. Work out last months number (01-12) and the number of days within
 VC> it ie 30 for month 11, 31 for month 12, 28 for month 02 unless a leap 
 VC> year then its 
 VC> 29.
 VC> 2. Having run (1) create command string to be executed within the
 VC> script as shown above with 'foo' comand line.

It may be more simple to keep a record of when the command was last run,
e.g. a re-directed current date MMYY to a file for when it was last
invoked.  Something along the lines of:

  type/cat the MMYY.file (contents) to a memvar
  compare memvar with current.date MMYY
    if different
      run the command
      re-direct current.date MMYY to MMYY.file
    else
      do nothing
  release memvar
  exit

You would need to 'seed' the process with a manual re-direction.  If you
want a general-purpose tool, as I think you do, then you'll end up with a
library of each 'foo' commands own MMYY.file file.

Cheers,
Paul.

--- Radius/W32 4.010/03.12.03-beta
* Origin: If it itches, it will be scratched. (ZMH only) (3:640/384)
SEEN-BY: 633/267 270
@PATH: 640/384 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.