From aa812d6e0f27da4ca0b97ee758f07796dd92fd04 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 24 Aug 2025 10:35:52 +0200 Subject: [PATCH] feat(notes): exit 1 w/ failues; wrap args in quotes to handle spaces --- notes.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/notes.sh b/notes.sh index ae3b02f..27afbe0 100755 --- a/notes.sh +++ b/notes.sh @@ -1,4 +1,4 @@ -#! /usr/bin/bash +#!/usr/bin/bash # Load config . ${HOME}/ayo.conf @@ -26,7 +26,7 @@ function createNote() { if [ "$title" = "" ]; then echo "Title cannot be empty." - exit; + exit 1; fi; file_name=$title.md @@ -37,15 +37,16 @@ function createNote() { install -Dv /dev/null "$full_path" >/dev/null # TODO: update to correct heading from old entries heading="# $title" - echo $heading > "$full_path" + echo "$heading" > "$full_path" date_heading=$(date +'%b %d, %Y, %a %r') - echo $date_heading >> "$full_path" + echo "$date_heading" >> "$full_path" fi editFile "$full_path" } || { echo ">>> New note failed" + exit 1 } }