Skip to content

Instantly share code, notes, and snippets.

@juanisierra
Last active October 22, 2016 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanisierra/764818dd52099e2dc8a9d58e3436a19e to your computer and use it in GitHub Desktop.
Save juanisierra/764818dd52099e2dc8a9d58e3436a19e to your computer and use it in GitHub Desktop.
Adds short notes into github repositories and auto-commits them
#!/bin/bash
#Absolute path to the file containing the notes (inside an SSH-cloned repository)
fileDIR=/home/juani/Documentos/journal/misc/
FILENAME=notes.md
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && (cd $fileDIR && git pull) || echo 'Error, no hay conexion a internet, no se pudo pullear'
cd $FILEDIR
echo "* "$1" " >> $fileDIR$FILENAME
ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && (cd $fileDIR && git add . && git commit -m "autoCommit" && git push) || echo 'Error, no hay conexion a internet, no se pudo pushear'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment