advent-of-code/utils/new_day.sh
2021-12-01 15:29:21 +01:00

13 lines
270 B
Bash
Executable File

if [[ ! -e .git ]]; then
echo "Merci de se déplacer dans le répertoire approprié"
exit 0
fi;
YEAR=$(date +%Y)
DAY=$(date +%d)
FILENAME="${YEAR}/day${DAY}.py"
cp utils/template.py "$FILENAME"
sed -i "s/DAY/${DAY}/" "$FILENAME"
sed -i "s/YEAR/${YEAR}/" "$FILENAME"