meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Monday, February 05, 2007

Unix Tip: Last workday of the month

By Sandra Henry-Stocker

In a column published last year, we looked at various ways to write scripts that would only run on the last day of the month. Determining whether an arbitrary day is the last day of the month can be done in a number of ways, using the cal and/or the date command. For example, if tomorrow is the first, then today must be the last day of the month. This gets us around the complexity of months with 28, 30 or 31 days.

When a reader recently asked how to write a script that would only run on the last workday of the month, a new twist was added to the old problem. A day is the last workday of a month only if it's a weekday and the following weekday falls in the next calender month. So, I came up with two approaches to solving the new challenge.

Read the full article here.

0 Comments:

Post a Comment

<< Home