diff --git a/notes.sh b/notes.sh index 6377490..a565472 100755 --- a/notes.sh +++ b/notes.sh @@ -14,14 +14,16 @@ function createNote() { title="${@:1}" fi + file_date="$(date +'%m.%d.%Y')" + if [ "$title" = "" ]; then - echo "Title cannot be empty." - exit 1; + title="$file_date" + file_name="${file_date}.md" + else + file_name="${file_date}-${title}.md" fi; - file_date="$(date +'%m.%d.%Y')" - file_name="$title.md" - full_path="${notes_dir}/${file_date}-${file_name}" + full_path="${notes_dir}/${file_name}" # IF Not Exists: create file with: # - title