Here is something I cooked up which I find useful because I've got
more than one project going, and I do more than one work session per
day. It is a BASH script that tracks progress against the daily word
goal on a cumulative basis, and across all files that have "*.txt"
style naming.
If you are a Linuxer maybe it will be of some interest, of course if
it isn't of interest, then no harm done by posting it, I trust.
-----------------------cut line
#!/bin/bash
# Wrapper script for jdarkroom writing work session which keeps daily
# stats across a group of files and measures against your daily goal.
# You get speed stats, too, and "time remaining" to meet your goal.
# If you are working on multiple projects you may find this script
# useful. (Or not...)
# Tested on Ubuntu Linux 10.04. Very likely to run on most any Linux
# (and please let me know if not). Windowsor Mac? Nah.
# Must be run in a term, set launchers accordingly.
# Make changes below for your environment as indicated in the code.
# No warranties provided, no liabilities accepted, no support
promised.
# You may use this in any legal way you wish without charge.
# Bug reports, suggestions:
ew...@bobnewell.net
# but no promises made as to fixing bugs or anything else.
# Yes, the coding could be tighter and smarter and better!
# Major issue: if you delete .txt files, merge them, delete from them,
# etc., cut and paste to increase their length, or other such
operations,
# during your edit session (outside the session is not a problem)
# this script won't know about it, and your daily stats will be hosed.
# Copyright (C) 2010 Futrezo Software Solutions,
# a division of Mr. Fred Investments. All rights reserved.
# 10/14/2010 0.21 Took care of negative word count issues.
# Never go below zero words.
# Adapted for more normal use (don't ask).
# Move elg files to subdir.
# 10/13/2010 0.2 Removed unnecessary "*.TXT" caps entries.
# Corrected ignorant usage of 'let'.
# Save daily word, time totals, word per minute,
# and goal target and achieval information
# to a .elg file with today's date.
# Many of these are going to accumulate but we do not
# delete to save the historical record. A better
idea
# *might* be to have a single file with a line per
day.
# SED, maybe?
# The words per minute and time remaining are skewed
by
# dropping seconds, especially for short sessions, so
# we do half-minute based rounding (yes, it's lame).
# Added comments and spacing.
# Corrected and added bugs.
# 10/12/2010 0.1 Honolulu, Bob Newell
# Initial coding.
############# EDIT HERE
# Change the directory and program, and word goal to whatever is
suitable.
cd /home/bnewell/Documents/jdr
goal=1000
work="jdarkroom"
############# END EDITS
# We are interested in all .txt files. Change this any way you like.
# Get the current word count total for these files.
wci=`wc *.txt 2>/dev/null|grep total|awk '{print $2}'`
# Get the starting time in seconds since creation (more or less).
ti=`date +%s`
# Execute the work program.
$work
# Get the stop time.
let to=`date +%s`
# Get the word count after the work session.
wco=`wc *.txt 2>/dev/null|grep total|awk '{print $2}'`
# Find differences, which are the session word and time counts.
# Convert time to minutes, doing some feeble rounding (if the
# seconds are over 30 we go to the next minute).
# But always count one minute minimum (to avoid divide by zero
issues).
let wcd=$wco-$wci
if [[ $wcd -lt 0 ]]
then
wcd=0
fi
let tds=($to-$ti)/60
let secs=$tds%60
if [[ $secs -gt 30 ]]
then
let tds=$tds+1
fi
if [[ $tds -lt 1 ]]
then
tds=1
fi
# See if we have a parameter file for today.
# If we do, read it, and add the session totals to the daily totals.
# If not, the session totals equal the daily totals.
today=`date +%Y%m%d`".elg"
if [[ -f "elg/$today" ]]
then
wct=`cat elg/$today|awk '{print $1}'`
tdt=`cat elg/$today|awk '{print $2}'`
let wct=$wct+$wcd
let tdt=$tdt+$tds
else
wct=$wcd
tdt=$tds
fi
# Find words per minute. Allow for zero words case.
if [[ $wcd -eq 0 ]]
then
wpms=0
else
let wpms=$wcd/$tds
fi
if [[ $wct -eq 0 ]]
then
wpmt=0
else
let wpmt=$wct/$tdt
fi
# Do the goal calculations. No credit for over-goal levels.
let wleft=$goal-$wct
if [[ $wleft -lt 0 ]]
then
wleft=0
fi
if [[ $wpmt > 0 ]]
then
let tleft=$wleft/$wpmt
else
tleft="unknown"
fi
# Output parameters in a single line of total words, total time, words
# per minute, goal, words remaining, estimated time remaining (to
goal).
echo $wct " " $tdt " " $wpmt " " $goal " " $wleft " " $tleft >"elg/
$today"
# Clear the screen and show the work stats.
clear
echo "Words this session : " $wcd
echo "Minutes this session : " $tds
echo "WPM this session : " $wpms
echo "Words today : " $wct
echo "Minutes today : " $tdt
echo "Words per minute today : " $wpmt
echo "Today's word quota : " $goal
echo "Words left to go : " $wleft
echo "Est. min. to finish : " $tleft
# Politely wait for acknowledgement.
read -p "(press enter)"
------------------cut line