Thursday, June 9, 2016

Bash: Posts Per Hour

Command (for this year's post per hour):

$ posts=`./smashingtheory_posts_this_year.sh`;doy=`date +%j`;hour=`date +%H`; echo "scale=4;$posts / ($doy * 24 + $hour)" | bc -l | tr '\n' ' '

Result:

.1248

Command (for this month's post per hour):

$ posts=`./smashingtheory_posts_this_month.sh`;dom=`date +%e`;hour=`date +%H`;echo "scale=4;$posts / ($dom * 24 + $hour)" | bc -l | tr '\n' ' '

Result:

.1710