Program (logdetect.sh)
#!/bin/bash
#Detect the user at logon
while true
do
if who|grep $1>/dev/null
then
echo $1 is logged in
exit
fi
done
Output
[vijai@localhost command]$ sh logdetect.sh cse1
cse1 is logged in
#!/bin/bash
#Detect the user at logon
while true
do
if who|grep $1>/dev/null
then
echo $1 is logged in
exit
fi
done
Output
[vijai@localhost command]$ sh logdetect.sh cse1
cse1 is logged in
No comments:
Post a Comment