Days of the week array

This snippet will give you the days of the week but human-readable in your own language.

today=$(date +%u)
yesterday=$((today-1))

dagen=(
        'zondag'
        'maandag'
        'dinsdag'
        'woensdag'
        'donderdag'
        'vrijdag'
        'zaterdag'
        'zondag'
      )

today=${dagen[$vandaag]}
yesterday=${dagen[$gisteren]}

Now you can use $today and $yesterday as variables in folder names, usefull for back-ups.

Published by

Maarten Keizer

Hosting guru. WordPress addict. n00b programmer.

Leave a Reply

Your email address will not be published. Required fields are marked *