Skip to content

Instantly share code, notes, and snippets.

@davewhit3
Created August 21, 2020 17:06
Show Gist options
  • Save davewhit3/4b9aba7fc4441e66796e5df670782fcc to your computer and use it in GitHub Desktop.
Save davewhit3/4b9aba7fc4441e66796e5df670782fcc to your computer and use it in GitHub Desktop.
HTTP requests status codes counter
#!/bin/bash
declare -a statuses
HOST="https://google.com"
for i in {1..100};
do
result=$(curl -I $HOST --silent 2>&1 | grep "HTTP/" | cut -d " " -f 2)
statuses["$result"]=$((statuses["$result"]+1))
done;
for key in "${!statuses[@]}"; do echo "$key => ${statuses[$key]}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment