Related Items  

Linux and Windows IT Support  

dedicated-technology-experts

Windows, Apple and Linux IT support and services.

For Software and Web Development.

Bash: determine if the week is odd or even

PrintE-mail

bash

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.

Add your comment

Your name:
Subject:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
   
Copyright © 1999 - 2024 Virtual Helpme | Trusted IT Services | Original Template: Allrounder