Skip to content

Instantly share code, notes, and snippets.

@peterdemin
Created February 4, 2022 17:19
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 peterdemin/9f1281e54f7e141b221c0c326fe4b7fa to your computer and use it in GitHub Desktop.
Save peterdemin/9f1281e54f7e141b221c0c326fe4b7fa to your computer and use it in GitHub Desktop.
SH script to append text to a file and synchronize it using git
#!/bin/sh
DIARY_DIR=~/diary
DIARY_FILE=README.md
cd ${DIARY_DIR}
git pull -q
echo >> ${DIARY_FILE}
date >> ${DIARY_FILE}
echo >> ${DIARY_FILE}
echo "$1" >> ${DIARY_FILE}
git commit -qam "logged from shell"
git push -q
echo "Journaled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment