DEV Community

Discussion on: Simple note taking from the command line

Collapse
 
xochilpili profile image
xOCh • Edited
notes(){
   if [ ! -z "$1" ]; then
       echo "[" $(date +"%Y%m%d %H:%M:%S"@$(hostname)"]" "@" >> "$HOME/notes.md";
   else
       if [ ! -f "$HOME/notes.md" ]; then
           echo "No notes!";
           #touch "$HOME/notes.md";
           exit 0;
       else
           cat - >> "$HOME/notes.md";
           # or cat "$HOME/notes.md"; for show all notes :P
       fi
   fi
}