-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathabout.sh
executable file
·94 lines (74 loc) · 2.15 KB
/
about.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
source config.cfg
figlet -f script "Your Profile"
curl -sX GET "https://graph.facebook.com/v2.3/me?fields=name%2Cpicture%2Cbirthday%2Cemail%2Chometown%2Cgender%2Ceducation%2Cwork%2Cgames%2Cbooks%2Cmusic%2Cmovies%2Cfavorite_athletes%2Cfavorite_teams&access_token=$access_token" > about.txt
name=$(jq -r '.name' about.txt)
gender=$(jq -r '.gender' about.txt)
hometown=$(jq -r '.hometown.name' about.txt)
email=$(jq -r '.email' about.txt)
favorite_teams=$(jq -r '.favorite_teams[].name' about.txt | tr "\n" '~')
favorite_athletes=$(jq -r '.favorite_athletes[].name' about.txt | tr "\n" '~')
games=$(jq -r '.games.data[].name' about.txt | tr "\n" '~')
music=$(jq -r '.music.data[].name' about.txt | tr "\n" '~')
movies=$(jq -r '.movies.data[].name' about.txt | tr "\n" '~')
birthday=$(jq -r '.birthday' about.txt)
books=$(jq -r '.books.data[].name' about.txt | tr "\n" '~')
picture=$(jq -r '.picture.data.url' about.txt)
echo -e "Name: $name\n\n"
echo -e "Profile Picture:$picture\n\n"
echo -e "Birthday: $birthday\n\n"
echo -e "Email: $email\n\n"
echo -e "Hometown: $hometown\n\n"
echo -e "Gender: $gender\n\n"
echo -e "Education:"
count=$(jq -r '.education | length' about.txt)
i=0
for((i=0;i<count;i++))
do
echo -e "$(jq -r ".education[$i].type" about.txt):\c"
echo -e $(jq -r ".education[$i].school.name" about.txt)
done
echo
count=$(jq -r '.work | length' about.txt)
i=0
if [ $count -ge 1 ]
then
echo -e "Work:"
for((i=0;i<count;i++))
do
echo -e "Employer:$(jq -r ".work[$i].employer.name" about.txt)"
echo -e "Location:$(jq -r ".work[$i].location.name" about.txt)"
echo -e "Position:$(jq -r ".work[$i].position.name" about.txt)"
done
fi
echo
if [ -n "$games" ]
then
echo -e "Games:"
echo -e $games | tr '~' "\n"
fi
if [ -n "$books" ]
then
echo -e "Books:"
echo -e $books | tr '~' "\n"
fi
if [ -n "$music" ]
then
echo -e "Music:"
echo -e $music | tr '~' "\n"
fi
if [ -n "$movies" ]
then
echo -e "Movies:"
echo -e $movies | tr '~' "\n"
fi
if [ -n "$favorite_teams" ]
then
echo -e "Favorite teams:"
echo -e $favorite_teams | tr '~' "\n"
fi
if [ -n "favorite_athletes" ]
then
echo -e "Favorite athletes:"
echo -e $favorite_athletes | tr '~' "\n"
fi