2012-04-08 23:05:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# journal script for keeping
|
|
|
|
# track of what i do and think
|
|
|
|
|
|
|
|
|
|
|
|
#check if output file is given as first option
|
|
|
|
if [ -z $1 ]; then
|
|
|
|
outputfile=journal.txt
|
|
|
|
else
|
|
|
|
outputfile=$1
|
|
|
|
fi
|
|
|
|
|
2012-04-08 23:22:10 +02:00
|
|
|
if [ -z $2 ]; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
if [ $2 = "read" ]; then
|
|
|
|
less $outputfile
|
|
|
|
exit $?
|
|
|
|
elif [ $2 = "edit" ]; then
|
|
|
|
vim $outputfile
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-04-08 23:05:12 +02:00
|
|
|
#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 ****
|