Add case to handle logout, login, other messages.

This commit is contained in:
Ceda EI 2018-04-20 00:39:58 +05:30
parent d981038d02
commit 0913db7020
1 changed files with 16 additions and 0 deletions

16
mark
View File

@ -4,6 +4,7 @@ source ~/.markrc
today=$(date +%Y-%m-%d\ %H:%M:%S) today=$(date +%Y-%m-%d\ %H:%M:%S)
file_path=$base_path/$(date +%Y-%m).txt file_path=$base_path/$(date +%Y-%m).txt
login_message=$username $today $login_message login_message=$username $today $login_message
logout_message=$username $today $logout_message
# Login if it is the first message of the day # Login if it is the first message of the day
if [[ -f $file_path ]]; then if [[ -f $file_path ]]; then
@ -15,3 +16,18 @@ if [[ -f $file_path ]]; then
else else
echo $login_message >> $file_path echo $login_message >> $file_path
fi 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