2016-02-13 32 views
-3

我需要一个bash脚本来刷新网页并检查自上次更新以来是否发生了更改。我能怎么做?使用临时文件?有人可以发布代码吗?脚本bash更新网页并检查是否有不同的东西

+3

对不起每小时变化率统计文件,StackOverflow的是_not_一个免费的编码服务。我建议你雇用一名程序员。 – arkascha

+0

请阅读整个[旅游](http://stackoverflow.com/tour)页面。 – Cyrus

+0

在旅程中,尝试搜索或两个关于'diff'命令,你可能会发现有用的。 –

回答

1

我用这个网站来生成有关在纽约时报的网页

#!/bin/bash 
currentDate=$(date +%k-%d-%m) 
lastDate=$(date +%k-%d-%m -d "now - 1 hour")   
historyLocation="/media/raid/mcs/webs/script/history" 
statisticsFile="/media/raid/mcs/webs/script/statistics" 
links -dump www.nytimes.com > $historyLocation/$currentDate #dumps current version 
echo $currentDate: >> $statisticsFile 
wdiff $historyLocation/$currentDate $historyLocation/$lastDate -s | tail -2 | head -1 | cut -d' ' -f14 >> $statisticsFile