forked from microsoft/azure-tools-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkfwlink.sh
33 lines (29 loc) · 825 Bytes
/
checkfwlink.sh
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
28
29
30
31
32
33
#!/bin/bash
FWLINKBASE="http://go.microsoft.com/fwlink/?LinkID="
LINKIDLIST=("286720" "620956" "512749" "526878" "252838" "255555" "255557" "267429" "400838" "723585" "722349&clcid=0x409" "824704" "847862")
result=()
function check() {
url="${FWLINKBASE}$1"
echo ${url}
respcode=`curl -L -i -o /dev/null --silent -w "\n%{http_code}" ${url}`
if [ $? -ne 0 ]; then
echo "Invalid URL ${url} with error"
result=(${result[@]} ${url})
elif [ "${respcode}" -ne 200 ]; then
echo "Invalid URL ${url} with code ${respcode}"
result=(${result[@]} ${url})
fi
}
for id in ${LINKIDLIST[@]}
do
check ${id}
done
if [ ${#result[@]} -ne 0 ]; then
content=`printf ",%s" ${result[@]}`
content="Found ${#result[@]} invalid URLS${content}";
echo ${content}
exit ${#result[@]}
else
echo "All fw link is available"
exit 0
fi