1
1
Fork 0

journal.sh

This commit is contained in:
David Starzengruber 2012-04-09 00:59:05 +02:00
parent c5c5fb6f8a
commit fbed644944
1 changed files with 10 additions and 1 deletions

View File

@ -14,6 +14,9 @@
# journal edit
#set repopath
repopath="/home/david/docs"
#check if output file is given as first option
if [ -z $1 ]; then
outputfile=journal.txt
@ -30,16 +33,22 @@ else
elif [ $2 = "edit" ]; then
vim $outputfile
exit $?
elif [ $2 = "sync" ]; then
cd $repopath
git add *
git commit -am "changes by $HOSTNAME. syncing git repo."
git push
exit $?
fi
fi
#generating timestamp
timestamp=$(date '+%d.%m.%Y %H:%M')
#read journal entry from stdin
echo "enter oneliner into journal:"; read input
#writing to outputfile
echo "**** $timestamp ****" >> $outputfile
echo $input >> $outputfile