#!/bin/bash # Check if the first argument starts with [ and ends with ] if [[ "$1" =~ ^\[.*\]$ ]]; then CATEGORY="${1^^}" # Uppercase the tag shift # Remove the category from the argument list ARGS="$*" # The rest of the message else CATEGORY="GENERAL" ARGS="$*" fi # Generate timestamp TS=$(date +%s.%N) # Log to file echo "$TS [$CATEGORY] $ARGS" >> /home/kof/src/now/log # Print to stdout echo "$TS" # Git operations cd /home/kof/src/now git commit -am "$TS [$CATEGORY] $ARGS" git pull git push