$stitle
" echo "$sbyline
" echo "$sbody" echo "#!/usr/bin/env bash ## NPR to PDF ## This script pulls stories from text.npr.org, and assembles them into ## a PDF suitable for reading offline. topics=( 1003 # National 1004 # World 1006 # Business 1007 # Science 1013 # Education 1017 # Economy 1019 # Technology 1008 # Arts & Life ) tmphtml="$(mktemp).html" trap "rm -f $tmphtml" EXIT tmppdf="/tmp/NPR-$(date "+%Y-%m-%d").pdf" site="https://text.npr.org" function get_topic_stories { tid=$1 turl="$site/t.php?tid=$tid" tpage="$(curl --silent "$turl")" ttitle="$(echo "$tpage" | sed '13p;d' | awk -F'Topic: ' '{print $2}' | awk -F'<' '{print $1}')" readarray sids < <(echo "$tpage" | sed '13p;d' | sed 's/
' | sed '3p;d' | sed 's|
||g' | sed 's|
||g')" sbyline="$(echo "$spage" | grep '' | sed '4p;d' | sed 's|
||g' | sed 's|
||g')" sbody="$(echo "$spage" | grep '' | tail -n +5 | head -n -1)"
echo " $sbyline$stitle
"
echo "