From 9b32145fe85e277160d54a8c6411b578464e91f8 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 13 May 2024 10:39:22 +0100 Subject: Rename --- jobblylogger.sh | 25 ------------------------- jobbylogger.sh | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 25 deletions(-) delete mode 100755 jobblylogger.sh create mode 100755 jobbylogger.sh diff --git a/jobblylogger.sh b/jobblylogger.sh deleted file mode 100755 index b3e2b5c..0000000 --- a/jobblylogger.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Check if both date and comment are provided -if [ $# -lt 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -# Extract date and comment from command line arguments -date="$1" -comment="$2" - -# Format the date string to match SQLite's format (YYYY-MM-DD HH:MM:SS) -formatted_date=$(date -d "$date" +"%Y-%m-%d %H:%M:%S") - -# SQLite command to insert the record -sqlite3 ~/Documents/Notes/jobblylogger.db "INSERT INTO jobbies (date, comments) VALUES ('$formatted_date', '$comment');" - -# Check if the insertion was successful -if [ $? -eq 0 ]; then - echo "Record inserted successfully." -else - echo "Failed to insert record." -fi - diff --git a/jobbylogger.sh b/jobbylogger.sh new file mode 100755 index 0000000..bf65f72 --- /dev/null +++ b/jobbylogger.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Check if both date and comment are provided +if [ $# -lt 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Extract date and comment from command line arguments +date="$1" +comment="$2" + +# Format the date string to match SQLite's format (YYYY-MM-DD HH:MM:SS) +formatted_date=$(date -d "$date" +"%Y-%m-%d %H:%M:%S") + +# SQLite command to insert the record +sqlite3 ~/Documents/Notes/jobbylogger.db "INSERT INTO jobbies (date, comments) VALUES ('$formatted_date', '$comment');" + +# Check if the insertion was successful +if [ $? -eq 0 ]; then + echo "Record inserted successfully." +else + echo "Failed to insert record." +fi + -- cgit v1.2.3