blob: c2e875ddb24f1072512134a83f296f952cdf3404 (
plain) (
tree)
|
|
#!/bin/bash
# Our target file
TODAY_JOURNAL=~/Documents/Notes/journal/home/$(date +\%Y-\%m-\%d).md
# Test whether it already exisits or not
if [[ -a $TODAY_JOURNAL ]]
then
while read -r line
do
JLINE="- $(date +'%H:%M'): $line"
echo "$JLINE" >> "$TODAY_JOURNAL"
done < "${1:-/dev/stdin}"
else
touch "$TODAY_JOURNAL"
header_date="$(date +'%A %d %b %Y')"
{ echo -e "# $header_date\n"
echo -e "## Journal\n"
} >> "$TODAY_JOURNAL"
while read -r line
do
JLINE="- $(date +'%H:%M'): $line"
echo "$JLINE" >> "$TODAY_JOURNAL"
done < "${1:-/dev/stdin}"
fi
|