Browse Source

Add case to handle logout, login, other messages.

wip
Ceda ei 7 years ago
parent
commit
0913db7020
  1. 16
      mark

16
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

Loading…
Cancel
Save