#!/bin/bash

#set -x

show=20

function keep_it_short
{
	lines="$(cat)"
	numlines=$(echo "$lines" | wc -l)
	echo "$lines" | head -"$show"
	#echo $numlines
	if [ "$numlines" -gt "$show" ]
	then
		echo $(expr $numlines - "$show") lines not shown for brevity
	fi
}

while read account
do
	default_group="$(grep ^$account: /etc/passwd | awk -F':' ' { print $4 } ')"
	echo "Account $account:"
	echo
	echo Processes currently running as "$account":
	ps -ef | grep "^ *$account " | keep_it_short
	echo
	echo
	echo Current password entries for "$account":
	grep "^$account:" /etc/passwd | keep_it_short
	echo
	echo
	echo Password entries for "$account" as originally shipped with "$(uname -s) $(uname -r)":
	grep "^$account:" /etc/passwd.original | keep_it_short
	echo
	echo
	echo Files owned by "$account":
	find / /usr /var /opt -xdev -user $account -print | keep_it_short
	echo
	echo
	echo
	echo
	echo '/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\'
done


