I needed to write a small script Shell bash script
The task is as follows:
"Develop a program that outputs information about users in the system after a certain time interval: who went in, who went out."
I tried to do this:
#!/bin/bash
while [ true ]; do
clear
date
who
sleep 5
done
then i tried like this:
#!/bin/bash
while [ true ]; do
clear
date
$USER
sleep 5
done
But everything is still the same.Only the date is displayed.(I run with windows through git bash)
What am I doing wrong?
As far as I understand, the commands that I have prescribed should simply show those who are in the system. But how exactly to deduce who entered and who left?
I thank you in advance for your help, I'm quite new to this and don't understand much, sorry.
apropos -r -s 1,8 'log.*in' | grep -i -e user
(it searches through the pages of your system's manual; useman apropos
,man man
andman grep
to read more on it). Chances are that (at least) one of the listed commands has the ability to show the logins to your system, possibly filtered by date and time.apropos -r
withman -k
in the command I suggested in my previous comment.