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
For this programming assignment, you are to develop a Fortran 90/95/2003 program to automate a useful task. The aim of the assignment is for you to reveal your competence in the Fo

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to  use for writing a Perl program tha

We'll start this section off with the material which most text books that will cover in this section. We will take the matter from the Second Order chapter and expand this out to n

What is .NET TECHNOLOGY? .NET technological innovation was presented by Enthusiasm, to get the industry from the SUN's Coffee. Few in the past, Enthusiasm had only VC++ and VB

Is it possible to get an assignment done within 2 hours

The following function calls supposedly write a single new-line character, but some are incorrect. Identify which calls don't work and explain why.     printf("%c", '\n');

using UML 1- Identify primary classes 2- Scenario description 3- Class diagrams 4- Sequence diagrams

This assignment begins software tools and techniques for structuring complex programs. Use it to become familiar with these facilities, and ensure you use the speci?ed concepts in

Define the Control statements in Computer Programming? The statements are part of the program that performs some action. The compiler will check a program sequentially from the

(a) Define a procedure called make-avl-tree which makes an AVL tree with one node. Also create another constructor build-avl-tree that creates an AVL tree from a root, left subtree