-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrape.sh
25 lines (19 loc) · 826 Bytes
/
scrape.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
#!bin/bash/
echo -e "-----------------------------------------"
number_of_users=$(grep '100.*[^:]' /etc/group | wc -l)
echo "Total number of users: $number_of_users"
users=$(grep '100.*[^:]' /etc/group | cut -d: -f1)
echo -e "List of all users: "
echo -e $users
echo -e "\n"
number_of_admin=$(grep sudo /etc/group | cut -d: -f4 | tr ',' '\n' | wc -l)
echo -e "Number of admin users: $number_of_admin"
echo -e "List of admin users: "
admin_users=$(grep sudo /etc/group | cut -d: -f4 | tr ',' '\n')
echo -e $admin_users
echo -e "\n"
let "number_of_non_admin=$number_of_users-$number_of_admin"
echo -e "Number of non admin users: $number_of_non_admin"
echo -e "List of non admin users: "
comm -23 <(tr ' ' $'\n' <<< $users | sort) <(tr ' ' $'\n' <<< $admin_users | sort)
echo -e "-----------------------------------------"