Operating System Shell Scripting/Programs on Linux
Linux Shell Scripting programs
Sunday, 17 June 2012
Write a shell script to accept the name of the user and check out if the same has logged in or not
echo Enter user name:
read user
f=1
for i in `who|tr -s " "|cut -d " " -f 1`
do
if [ $i = $user ]
then
echo The user is login now
f=0
break
fi
done
if [ $f != 0 ]
then
echo The user is logged off
fi
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment