Removes all events preceeding a given year from an .ics calendar file (the kind you can find e.g. in a Radicale-based CalDAV server).
./trim-calendar.sh Personal 2016 # removes all events starting before the year 2016 from the calendar stored in Personal.ics file
Be careful with just copying and pasting this snippet. In line 30 there is a hardcoded 2016 which should be replaced by $YEAR.
It would also be better to surround all variables with curly brackets like ${VARIABLE_NAME}. Bash best practice: "Surround your variables with {}. Otherwise bash will try to access the $ENVIRONMENT_app variable in /srv/$ENVIRONMENT_app, whereas you probably intended /srv/${ENVIRONMENT}_app."
But then you would need to overhaul the whole script :-)