I realize I could whip up a little C or Ruby program to do this, but I want my script to have as few dependencies as possible.
Given that caveat, how does one d
I realize I could whip up a little C or Ruby program to do this, but I want my script to have as few dependencies as possible.
Doing in C or as a Ruby script would result in less dependancies, and be more cross-platform.. Bash-scripting just calls various other scripts/applications, mainly the GNU utilities.. Many of the commands are unavailable, or take different arguments on other platforms (especially between OS X and Linux)..
Ruby is included by default on OS X Leopard (and 10.4, and probably previous versions if I recall correctly), and if you use Rubys built-in date libraries, it will work consistently on any platform.
Whenever you try to do anything remotely complicated, you are generally best of using a "proper" scripting language!