mirror of https://github.com/codefeathers/mark
Muthu Kumar
7 years ago
2 changed files with 0 additions and 39 deletions
@ -1,35 +0,0 @@ |
|||||
#!/usr/bin/env bash |
|
||||
|
|
||||
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 |
|
||||
last_line=$(tail -n1 $file_path) |
|
||||
last_day=$(echo $last_line | sed 's/[^ ]* [^-]*-[^-]*-\([^ ]*\).*/\1/') |
|
||||
if [[ $last_day != $(date +%d) ]]; then |
|
||||
echo $login_message >> $file_path |
|
||||
fi |
|
||||
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 |
|
||||
;; |
|
||||
esac |
|
@ -1,4 +0,0 @@ |
|||||
base_path="$HOME/mark" |
|
||||
username=$(whoami) |
|
||||
login_message="I am in" |
|
||||
logout_message="I am out" |
|
Loading…
Reference in new issue