Ok first to take the simple concept as greping the output of who /var/adm/wtmp command for a date in this formate "Month date_of_month"
for example,
who /var/adm/wtmp | grep "May 17"
To list all users logged in on May 17 (assuming that its today's date which can be derived from the date command)
To get the Month: month=$(date +"%b")
To get the date of the month: today=$(date +"%d")
Now the trick is to go back one day at a time (up to 7 days ago) which you need to subtract today's dates from yesterday and the day before and so on. To do this i advice you to go throught this link which describe how to subtract dates.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.