-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path55-githubuser
More file actions
29 lines (27 loc) · 816 Bytes
/
55-githubuser
File metadata and controls
29 lines (27 loc) · 816 Bytes
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
#!/bin/bash
# githubuser--Given a GitHub username, pulls information about them.
if [ $# -ne 1 ]; then
echo "Usage: $0 <username>"
exit 1
fi
# The -s silences curl's normally verbose output.
curl -s "https://api.github.com/users/$1" | \
awk -F'"' '
/\"name\":/ {
print $4" is the name of the Github user."
}
/\"followers\":/{
split($3, a, " ")
sub(/,/, "", a[2])
print "They have "a[2]" followers."
}
/\"following\":/{
split($3, a, " ")
sub(/,/, "", a[2])
print "They are following "a[2]" other users."
}
/\"created_at\":/{
print "Their account was created on "$4"."
}
'
exit 0