#!/bin/sh ## module for getting estimated time to read an article ## usage: ## readingtime [file] ## exports: ## READING_TIME in minutes ## config vars wordsPerMinute=200 # first clean special symbols and lines with whitespace wordcount=`sed -e 's/[^A-Za-z0-9 ]//g' -e '/^\s*$/d' "$1" | wc -w` export READING_TIME=$(expr $(expr $wordcount / $wordsPerMinute) + 1)