What method can one use to alternate a variable which is dependable by time?
For example, this week var = Office, then next week var = Oncall?
The resulting script will be using crontab to output the contents of var depending on which week it was.
Thanks.
You can use date +%W
to check what week number of the year it is (starting Monday).
You can alternate between the two with e.g.
if (( $(date +%W) % 2 ))
then
var=Office
else
var=Oncall
fi
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments