Csandriel

mlog

Aug 13th, 2020 (edited)
1,318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/bash
  2. #mlog
  3. #Csandriel
  4. #~2015
  5.  
  6.  
  7. DELIM="---------------------------------------------"
  8. FILE="/home/user/mylog"
  9. APPEND=false
  10.  
  11. if [ "$1" ==  "-a" ]
  12. then
  13.     APPEND=true
  14.     echo Ready to APPEND to the last entry
  15. elif [ "$1" == "-l" ]; then
  16.     cat "$FILE"
  17.     exit 0
  18. elif [  "$1" ]; then
  19.     echo key invalid
  20.     exit 1
  21. else   
  22.     echo Ready to recieve a NEW log entry:
  23.  
  24. fi
  25.  
  26. read
  27.     if ! $APPEND
  28.     then
  29.         echo -e "\n$DELIM\n">>$FILE
  30.         echo -e "\t`date`\n">>$FILE
  31.     fi
  32. echo $REPLY>>$FILE
  33. exit 0
Add Comment
Please, Sign In to add comment