16c16 < if test ! -d $datadir --- > if test ! -d "$datadir" 18c18 < mkdir $datadir --- > mkdir "$datadir" 23a24,29 > # If this is the first time, touch podcast.log to shut up the grep below. > if ! [ -e podcast.log ] > then > touch podcast.log > fi > 30c36 < if ! grep "$url" podcast.log > /dev/null --- > if ! grep "^$url$" podcast.log > /dev/null 32c38 < wget -q -P $datadir "$url" && echo $url >> temp.log --- > wget -q -P "$datadir" "$url" && echo "$url" >> temp.log 36,41c42,55 < # Move dynamically created log file to permanent log file: < cat podcast.log >> temp.log < sort temp.log | uniq > podcast.log < rm temp.log < # Create an m3u playlist: < ls $datadir | grep -v m3u > $datadir/podcast.m3u --- > # Move dynamically created log file (if any) to permanent log file: > if [ -s temp.log ] > then > cat podcast.log >> temp.log > sort -u temp.log > podcast.log > fi > rm -f temp.log > > # If nothing was downloaded, just remove the download directory. Else > # create an m3u playlist: > if ! rmdir 2> /dev/null "$datadir" > then > ls "$datadir" | grep -v '\.m3u$' > "$datadir"/podcast.m3u > fi