Shell script to check whether user has logged in or not, Programming Languages

W.A.S.S to check whether user has logged in or not.

 

Program

 

# W.A.S.S to check whether user has logged in or not.

 

echo "Enter the user name:"

read usr

flag=0

for w in ` who | tr -s " " | cut -d " " -f1`

do

if test $usr = $w

then

echo "User is logged in.."

flag=1

fi

done

 

if test $flag = 0

then

            echo "User is Not logged in.."

fi

 

Output:

 

Enter the user name:

root

User is logged in..

 

Enter the user name:

narenda

             User is Not logged in

Posted Date: 9/26/2012 6:31:46 AM | Location : United States







Related Discussions:- Shell script to check whether user has logged in or not, Assignment Help, Ask Question on Shell script to check whether user has logged in or not, Get Answer, Expert's Help, Shell script to check whether user has logged in or not Discussions

Write discussion on Shell script to check whether user has logged in or not
Your posts are moderated
Related Questions
CrowdSporting Website Development I want an advanced web developer to spend 1-2 days coding our newly designed website. It will be a single page scrolling site, fully designed a

Hi how can I upload my hw to you experts?

Solve the following initial value problem y (3) - 5y'' - 22y' + 56 y= 0;       y(0) = 1;           y'(0) = -2;         y''(0) = -4 Solution : r 3 - 5r 2 - 22r + 56 = (

Shemrock Inc. is a brake pad manufacturing company. This company uses raw materials, such as carbon powder, iron, ash, and resin. It wants to develop an inventory management system

Determine the solution to the following differential equation. x 2 y′′ + 3xy′ + 4 y = 0   Solution Find the roots to (3) first as generally. r(r -1) + 3r + 4 = 0 r

Please choose the best tutor to rewrite my assignment Ticket ID # EM201713THA711DSTN.because insructor does not accept. Thank you

Write a booking and pricing system for seats for performances in a theatre. Design and write a system to handle information (equipment, people, events etc.) for a club. Given

You have been employed by a bounty hunter to create hit list (yes... you better do this right). Create a Hit List program that can records the name, bounty, and difficulty for ten

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

In combat simulation software, exploding land mines cause damage to military vehicles. In addition to the damage done to the vehicles themselves, we are interested in the number of