From 281ffa2e971c7607b998394b49eedd1a9b38fe1b Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 16 Mar 2023 17:13:26 +0000 Subject: new bash script to replace tjclip fish funtion which relied on _tj --- tjclip-alternate.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tjclip-alternate.sh diff --git a/tjclip-alternate.sh b/tjclip-alternate.sh new file mode 100755 index 0000000..501edfe --- /dev/null +++ b/tjclip-alternate.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# this script replaces tjclip fish function which relied on _tj. + +# Our target file +TODAY_JOURNAL=~/Documents/Notes/journal/$(date +\%Y-\%m-\%d).md +URL="$(xclip -o clipboard clipboard)" + +# Test whether it already exisits or not +if [[ -a $TODAY_JOURNAL ]] +then + JLINE="- $(date +'%H:%M'): $1" + echo "$JLINE: $URL." >> "$TODAY_JOURNAL" +else + touch "$TODAY_JOURNAL" + header_date="$(date +'%A %d %b %Y')" + { echo -e "# $header_date\n" + } >> "$TODAY_JOURNAL" + JLINE="- $(date +'%H:%M'): $1" + echo "$JLINE: $URL." >> "$TODAY_JOURNAL" +fi -- cgit v1.2.3