Thankyou very much!
Yes, I’ll fire it from a crontab entry: so you suggest (if I’ve understood correctly: sorry but my english is not perfect…) to punt just a “$1” in the if and to add che date function to che cron line. Right?
Thankyou very much for your answer and for you patience!
Is it possible to do something like this:
12 2 * * 1-7 root do-backup <arguments>
and put as <argument> the function that retrieves the day of the week?
So in the script I’d just make the test as an “if $0…” and I can test the script manually passing the argument!
Well that line is interpreted like a command typed to the shell so you could put a date command in backticks there, but that defeats the purpose of taking the test out of the script, you’ve just executed the date command somewhere else. (And you have to watch out for %, which is special in crontabs, see the manual page.) Since you only have two cases, incremental and full, I think it is simpler to have two lines in the crontab.
Also * is the same as 1-7 in the weekday field.
And $0 is not the first argument, it’s the name of the script itself.