NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Various improvements (Score:1)
Unlike sh, bash has arithmetic evaluation that would make your script much simpler. I also wouldn’t check for the dotfile’s existence, just read it with error messages suppressed. It’s also bizarre that you’re using
date +%sto get the timestamp in one place andperl -e 'print time'in another – and the backticks around that second place are even more so. All in all here’s how I’d write that:But actually, “run the tests if it’s been 5 minutes since my last login” strikes me as a hack. I think what you rather want to say is “skip the tests if
cvs updidn’t find any updates to pull.” That would look something like this:This is based on the fact that
cvsprints itsU foo/bar.clines to stdin, but its chatter to stderr. So it copiescvs’s stdout to a temporary file whose size will be nonzero only ifcvsactually did any updates. The tests run only if that’s the case.Reply to This
Re: (Score:2)
By the way, I did implement many of your suggestions, thank you. However, I deliberately didn't want to go with the 'don't run tests if there are no updates to CVS'. There are plenty of other ways -- admittedly less common -- that tests can fail even without CVS updates. When those failures occur, I'd like to catch them!
Re: (Score:1)
Ah. Btw, a much more direct way to do this just occured to me: use the file’s mtime.
The idiomatic bit here is using
findto check the file’s age. The-mmin +5predicate means “if the mtime of the file under considerat