Shell Script- each unique user
- by Dinis Monteiro
Hi guys
I need "for each unique user, report which group they are a member of and when they last logged in"
so i have:
#!/bin/sh
echo "Your initial login:"
who | cut -d' ' -f1 | sort | uniq
echo "Now is logged:"
whoami
echo "Group ID:"
id -G $whoami
case $1 in
"-l") last -Fn 10 | tr -s " " ;;
*) last -Fn 10 | tr -s " " | egrep -v '(^reboot)|(^$)|(^wtmp a)|(^ftp)' | cut -d" " -f1,5,7 | sort -uM | uniq -c
esac
My question is: how i can show the each unique user? the script above only show the more recent user logged in the system, but i need all unique users.
anyone can help?
thanks