From 0913db702022b95faa121f6672813419035aa57e Mon Sep 17 00:00:00 2001 From: Ceda EI Date: Fri, 20 Apr 2018 00:39:58 +0530 Subject: [PATCH] Add case to handle logout, login, other messages. --- mark | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mark b/mark index 6a37caa..5bcdf61 100755 --- a/mark +++ b/mark @@ -4,6 +4,7 @@ source ~/.markrc today=$(date +%Y-%m-%d\ %H:%M:%S) file_path=$base_path/$(date +%Y-%m).txt login_message=$username $today $login_message +logout_message=$username $today $logout_message # Login if it is the first message of the day if [[ -f $file_path ]]; then @@ -15,3 +16,18 @@ if [[ -f $file_path ]]; then else echo $login_message >> $file_path fi + +case "$*" in + "" ) + echo "Include command" + ;; + login ) + exit + ;; + logout ) + echo $logout_message >> $file_path + exit + ;; + * ) + message=$(echo $* | sed "s/^/$username $today /") + echo $message >> $file_path