Bash: determine if the week is odd or even
We regularly post scripts and script snippets that we have found useful in our day-to-day IT support tasks. Here's a quick way to help determine if the week is odd or even using a bash script. You can replace the echo "even" and "odd" with whatever functions you are looking to perform, such as weekly backups for example. Although not tested, this script should also work on any version of Apple's Mac.
Copy and paste this into a file:
#!/bin/bash
WEEK=`date +"%V"`
if [ $(($WEEK%2)) -eq 0 ];
then
echo "even";
else
echo "odd";
fi
ALT is a one-stop IT consulting company, servicing clients in Ottawa, Central New York and Syracuse, Miami and South Florida. Contact us for your IT support needs and our expert consultants will be happy to assist.
Original article was posted on ALT Technical Consulting Miami.