diff --git a/note b/note index 55e651c..1beafa1 100644 --- a/note +++ b/note @@ -71,6 +71,9 @@ note Will open the note and save the notes to '$filename'. + note This is a message that will be added to the notefile. + You can create notes that are one line by directly typing it after note. + note --setfile Will open note just as before, but using instead. @@ -80,7 +83,38 @@ exit 1 ;; + + +# If there are no parameters entered. "") + echo 'Enter input or type :exit or :q to exit. :less to show contents.' + + read input + + saveDateOnce=0 + + # Loop until :exit or :q is entered. + while [ "$input" != ":exit" ] && [ "$input" != ":q" ]; do + # In case you want to have a quick overview of your text. + if [ "$input" == ":less" ]; then + less $filename + else + # Check if the date has been saved. + if [ $saveDateOnce == 0 ]; then + date >> $filename + saveDateOnce=1 + fi + echo "$input" >> $filename + fi + + read input + done +;; + + + +# Save an instant note. +*) date >> $filename if [ "$1" == "--setfile" ]; then # Start from the third input parameter and write to the file. @@ -88,38 +122,9 @@ else # Write all parameters entered to the file. echo "$@" >> $filename - fi - exit 1 + fi + exit 1 ;; -# Comment it out case it comes to use later. -# *) -# echo "That command does not exist. Write --help to know more."; -# exit 1 - esac - -echo 'Enter input or type :exit or :q to exit. :less to show contents.' - -read input - -saveDateOnce=0 - -# Loop until :exit or :q is entered. -while [ "$input" != ":exit" ] && [ "$input" != ":q" ]; do - # In case you want to have a quick overview of your text. - if [ "$input" == ":less" ]; then - less $filename - else - # Check if the date has been saved. - if [ $saveDateOnce == 0 ]; then - date >> $filename - saveDateOnce=1 - fi - echo "$input" >> $filename - fi - - read input -done -