From f539e454597079806bba60df452e212dd451d9dc Mon Sep 17 00:00:00 2001 From: Reed Wade Date: Mon, 2 Nov 2020 21:29:22 +0100 Subject: [PATCH] Prevent stderr that DRAFT_FILE could not be found. DRAFT_DIR is also used in the main loop so this prevent logging to sterr ls: cannot access '/home/foobar/.config/sxmo/modem/draft': No such file or directory Signed-off-by: Reed Wade Signed-off-by: Maarten van Gompel --- scripts/modem/sxmo_modemtext.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index d100165..75bc934 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -82,7 +82,6 @@ sendtextmenu() { draft() { NUMBER="$1" TEXT="$2" - mkdir -p "$DRAFT_DIR" DRAFT_FILE="$NUMBER-$(date +'%Y-%m-%d_%H-%m-%S')" echo "$NUMBER" > "$DRAFT_DIR/$DRAFT_FILE" echo "$TEXT" >> "$DRAFT_DIR/$DRAFT_FILE" @@ -111,6 +110,7 @@ tailtextlog() { } main() { + [ ! -d "$DRAFT_DIR" ] && mkdir -p "$DRAFT_DIR" # E.g. only display logfiles for directories that exist and join w contact name ENTRIES="$( printf %b "Close Menu\nSend a Text$( [ "$(ls -A "$DRAFT_DIR")" ] && printf %b "\nSend a Draft Text")\n";