diff --git a/note b/note index faac67c..55e651c 100644 --- a/note +++ b/note @@ -16,30 +16,44 @@ fi # Check if there is any arguments, if there is append all of it. -if [ "$para" == "--less" ]; then +case "$para" in + +--less) less $filename exit 1 -elif [ "$para" == "--edit" ]; then +;; + +--edit) vi $filename exit 1 -elif [ "$para" == "--vi" ]; then +;; + +--vi) vi $filename exit 1 -elif [ "$para" == "--gedit" ]; then +;; + +--gedit) gedit $filename exit 1 -elif [ "$para" == "--location" ]; then +;; + +--location) echo "$filename"; exit 1 -elif [ "$para" == "--author" ]; then +;; + +--author) echo "The author of this program is $author."; exit 1 -elif [ "$para" == "--version" ]; then +;; + +--version) echo "Version $version"; exit 1 -elif [ "$para" == "--help" ]; then +;; - +--help) echo -e 'Usage: note [--setfile ] [--less|--vi|--gedit|--help|--author|--version] @@ -54,6 +68,9 @@ --version Show current version Examples: + note + Will open the note and save the notes to '$filename'. + note --setfile Will open note just as before, but using instead. @@ -61,9 +78,9 @@ Will show using the less command. '; exit 1 +;; - -elif [ "$para" != "" ]; then +"") date >> $filename if [ "$1" == "--setfile" ]; then # Start from the third input parameter and write to the file. @@ -73,7 +90,15 @@ echo "$@" >> $filename fi exit 1 -fi +;; + +# 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.'