#!/bin/bash

output="fingers-found"

# find other fingers on ctrl-c.club
find /home -maxdepth 2 -name '.plan' -or -maxdepth 2 -name '.project' > fingers

# filter out all except for usernames and get rid of duplicates
cat fingers | cut -d/ -f3 | sort | uniq > finger2

mv finger2 fingers

#first clear the output file
if [ -f $output ]
then
    echo "" > $output
fi

while read user
do
    finger $user >> $output
    echo "==============================================================" >> $output

done < fingers

rm fingers
