timetracker/year-pack.sh

23 lines
328 B
Bash
Executable File

#!/bin/bash
MONTH=$(( $(date +%m) - 1 ))
if [ "x$1" == "x" ]
then
YEAR=$(( $(date +%Y) - 1))
ONESET=true
else
YEAR=$1
fi
echo "Tarring up for year ${YEAR}..."
if [ $MONTH -eq 0 ];
then
MONTH=12
if [[ ! ${ONESET} ]]; then
YEAR=$(( $YEAR - 1))
fi
fi
tar -cvJf $YEAR.tar $YEAR-*.tar.xz --remove-files