david/scripts-archive
david
/
scripts-archive
Archived
1
0
Fork 0
This repository has been archived on 2022-04-16. You can view files and clone it, but cannot push or open issues or pull requests.
scripts-archive/journal.sh

50 lines
904 B
Bash
Raw Permalink Normal View History

#!/bin/bash
#
# journal script for keeping
# track of what i do and think
#
# it makes sence you add a bash alias like this to your ~/.bashrc
# alias='/path/to/journal.sh /path/to/outputfile.txt'
# do that and you can use journal as follows:
# usage: journal
# journal read
# journal edit
#check if output file is given as first option
if [ -z $1 ]; then
outputfile=journal.txt
else
outputfile=$1
fi
if [ -z $2 ]; then
:
else
if [ $2 = "read" ]; then
less $outputfile
exit $?
elif [ $2 = "edit" ]; then
vim $outputfile
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
echo "" >> $outputfile
# **** end of script ****