A friend of yours has promised to log in at a particular time. However, he has not kept the promise. You want to contact him as soon as he logs in. Write a shell script which checks after every one-minute whether your friend has logged in or not. The logname should be supplied to the shell script at command prompt.
echo "Enter User number :"
read un
x=`who | grep $un |wc -l`
if [ $x -ne 0 ]
then
echo "User $un logged in "
else
while [ $x -eq 0 ]
do
sleep 2
x=`who|grep $un|wc -l`
if [ $x -ge 1 ]
then
echo "now user logged in "
write $un >hi
exit
fi
done
fi
Shopping In MUMBAI
Are you searching for Discounts, offers, sale in Mumbai ? You are in the right place. MUMBAI, a shopping haven, has no dearth of great discounts and sales. This blog features the best MUMBAI shopping offers, sale, discounts and deals and bargains CURRENTLY GOING on in Mumbai plus a few free things thrown in on top.
Don't wait for it because once they are gone, they are gone. Hurry!..By clicking the "Like" button you will receive a daily update of discounts, sale, offers going on in Mumbai. LIKE IT.... SHARE IT...njoY.
Thursday, January 22, 2009
Program in UNIX which checks after every one-minute whether user has logged in or not
Posted by ars at 4:52 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment