Advertisement
a_igin

Untitled

Apr 26th, 2020
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. check_urls () {
  4.   urls_file_path=$(pwd)/urls.txt
  5.   echo $urls_file_path
  6.  
  7.   if [ -f $urls_file_path ]
  8.   then
  9.     urls_list=$( cat $urls_file_path )
  10.     while read LINE; do
  11.       url_response_status=$(curl -Is $LINE | head -1)
  12.       STATUS=$(curl -s -o /dev/null -w '%{http_code}' $LINE)
  13.       echo $LINE $STATUS
  14.       if [[ $STATUS =~ ^[0,4,5] ]]
  15.       then
  16.         echo Error
  17.         break
  18.       fi
  19.     done < $urls_file_path
  20.   else
  21.     echo The file $urlf_file_path doesn\'t exists
  22.   fi
  23. }
  24.  
  25. check_urls
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement