Created
October 25, 2013 23:26
-
-
Save aprescott/7163358 to your computer and use it in GitHub Desktop.
* is a GitHubber!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )" | |
cd "$SCRIPT_DIR" | |
last_employee_count=$(cat last-employee-count) | |
last_employee_list="$(cat last-employee-list)" | |
employee_count=$(curl -s 'https://github.com/about/team' | grep -o '[0-9]* employees' | grep -o '[0-9]*') | |
employee_list="$(curl -s https://github.com/about/team | grep -e '<div class="employee">' -A 1 | grep -Po '(?<=<a href="/)[^"]+(?=">)')" | |
if [ $(wc -l <<<"$employee_list") -ne $employee_count ]; then | |
echo "Page states $employee_count employees, but list contains $(wc -l <<<"$employee_list")" | |
fi | |
if [ "$last_employee_list" != "$employee_list" ]; then | |
echo "Found different employees." | |
echo | |
echo "Employees no longer listed:" | |
comm -23 <(sort <<<"$last_employee_list") <(sort <<<"$employee_list") | |
echo | |
echo "Employees newly listed:" | |
comm -13 <(sort <<<"$last_employee_list") <(sort <<<"$employee_list") | |
fi | |
echo "$employee_list" > last-employee-list | |
echo "$employee_count" > last-employee-count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment