_为什么回来了,当然在他的网络服务器上留下假脱机信息。我想定期轮询他的网站,检查新线轴,如果它们不存在,请将它们转换为PDF。
我有民意调查&转换过程使用https://github.com/bsandrow/_why-spool。我在抓取脚本中修改了一个块,如下所示:
echo "Downloading PCL files..."
spool_urls | while read spool_entry; do
file="$(spool_file "$spool_entry")"
echo " $file"
if [ ! -f "/home/max/_why-spool/build/$file.pdf" ]
then
echo "/home/max/_why-spool/build/$file.pdf does not exist" >> /home/max/why_log.txt
wget -q -O "src/$file" "$spool_entry"
fi
done
这应该检查$file
。pdf是否存在。即使它确实存在,if
也会失败,并且无论如何都会下载该假脱机。我该如何解决这个问题?
ls
- 的结果
max build $ ls /home/max/_why-spool/build/
ACCOUNTS.pdf BURN.pdf FAREWELL.pdf FLIPPED.pdf HELLOYES.pdf JUXT.pdf OUTRAGE.pdf REALITY.pdf SACRED.pdf STINKS.pdf WHATSUPDOC.pdf
AMANDA.pdf CORRUPTION.pdf FIGHTS.pdf FRIGHTS.pdf IMPERSON.pdf LEAPS.pdf PIRATEO.pdf RECEIPT.pdf SEAWATER.pdf TORN.pdf YOUGETIT.pdf
BIBLICAL.pdf EYES.pdf FIRELESS.pdf GAIMAN.pdf ITISUS.pdf LOOKUP.pdf READING.pdf REVERSE.pdf SENSORED.pdf TRIALS.pdf
答案 0 :(得分:1)
我不能复制这个。我删除了一些文件来测试它,if
传递它应该通过。也许你可以试试其中一个
[[
-a
-e
$HOME
$ ls /home/Steven/_why-spool/build/ ACCOUNTS.pdf GINGERBREAD.pdf PROFESSORS.pdf SACRED.pdf STINKS.pdf CLOWNS.pdf HO.pdf RECEIPT.pdf SEAWATER.pdf $ scrape Downloading PCL files... STINKS GAIMAN /home/Steven/_why-spool/build/GAIMAN.pdf does not exist ACCOUNTS RECEIPT SEAWATER HELLOYES /home/Steven/_why-spool/build/HELLOYES.pdf does not exist SACRED CLOWNS BLANK /home/Steven/_why-spool/build/BLANK.pdf does not exist HO GINGERBREAD PROFESSORS