hi
i want to list last login at 7-19 everyday
i created script file like this (havent done because stuck somewhere)
Code:
#!/bin/bash
date=`date +%b" "%_d`
last=`last | grep "$date"`
echo $last
and the output:
Code:
[root@liang tmp]# sh last.sh
wikiadmi pts/1 192.168.238.1 Wed Feb 6 06:27 still logged in wikiadmi tty3 Wed Feb 6 05:40 still logged in wikiadmi tty2 Wed Feb 6 05:40 still logged in wikiadmi pts/0 :0.0 Wed Feb 6 05:25 still logged in wikiadmi tty1 :0 Wed Feb 6 05:25 still logged in reboot system boot 2.6.32-279.el6.x Wed Feb 6 05:24 - 05:50 (00:26) wikiadmi pts/0 192.168.238.1 Wed Feb 6 01:10 - 01:54 (00:44) reboot system boot 2.6.32-279.el6.x Wed Feb 6 01:08 - 05:50 (04:42)
[root@liang tmp]#
i have successfully grep the current date, but the "last command" output became 1 line, which is unreadable.
any help
thx