Bash: determine if the week is odd or even

bash

Here's a quick way to determine if the week is odd or even in bash. You can replace the "even" and "odd" with whatever functions you are looking to perform (eg. backup)

Copy and paste this into a file:

#!/bin/bash
WEEK=`date +"%V"`
if [ $(($WEEK%2)) -eq 0 ];
then
    echo "even";
else
    echo "odd";
fi