mirror of https://gitlab.com/ceda_ei/mark
Add case to handle logout, login, other messages.
This commit is contained in:
parent
d981038d02
commit
0913db7020
16
mark
16
mark
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue