1 #!/bin/bash
   2 
   3 cache=~/.newsbeuter/cache.db
   4 time1=$(date +%s)
   5 time2=$(date +%s -r $cache)
   6 diff=$(($time1 - $time2))
   7 
   8 (( $diff > ${1:-600} )) &&
   9 newsbeuter -x reload >&-
  10 
  11 n=$(
  12     newsbeuter -x print-unread |
  13     awk '{ n += $1 } END { print n }'
  14 )
  15 [[ $n != 0 ]] && echo  ${n:-?}
[raw]