summaryrefslogtreecommitdiffstats
path: root/diditchange
blob: b02fd155b80debe0d85e523b6457f34ebad8d35b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/zsh
#set -x
url=$1
DDIR="$HOME/.local/share/diditchange"
[[ ! -d $DDIR ]] && mkdir -p  $DDIR

file=$(tr  '/' '.' <<< ${url##*//})
tfile=`mktemp`
#curl -s $website
#echo $website
if [[ ! -f ${DDIR}/$file ]];then
    curl -s $url | md5sum > ${DDIR}/$file
    ~/bin/diditchange $url
else
    source ~/.zsh/.zsh_functions
    curl -s  $url  | md5sum >| $tfile

    if ! /usr/bin/diff $tfile ${DDIR}/$file; then
       cp $tfile ${DDIR}/$file
       mecho "Site  $url has changed"
    else
       mecho "No difference !"
       exit 1
    fi
fi
rm $tfile
#set +x