#!/bin/bash git checkout main > /dev/null git pull origin main || exit 1 # If no argument is supplied ask for the date of the next Stammtisch if [ $# -eq 0 ]; then echo "When is the next Stammtisch? (YYYY-MM-DD)" read date else date=$1 echo "Using date $date" fi # Parse the date year=$(echo $date | cut -d'-' -f1) month=$(echo $date | cut -d'-' -f2) day=$(echo $date | cut -d'-' -f3) dow=$(date -d $date +%A) Month=$(date -d $date +%B) root_dir=`git rev-parse --show-toplevel` filename="$year-$month-${day}_softwerke_stammtisch.md" # Create a new branch. delete it if it already exists git branch -D "events/$filename" > /dev/null 2>&1 git checkout -b "events/$filename" > /dev/null || exit 1 # Create the new file cat > "$root_dir/_events/$year/$filename" <