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

Assignment Help:

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


Related Discussions:- Shell script to check whether user has logged in or not

Document type definition schema, Create a DTD which describes the structure...

Create a DTD which describes the structure of the document which you prepared in Question 1. Make sure that you use all appropriate DTD ingredients to constrain valid documents as

To print total no.of ordinary files, Normal 0 false false f...

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

Corba multiple clients, I have an assignment that requires from me to run ...

I have an assignment that requires from me to run multiple clients and one server ( Corba)

Network management configuratio, You will create a simple network managemen...

You will create a simple network management configuration which checks that certain programs are running on your network and are performing as expected, and that certain system det

Vb assignment, Design an application that opens and analyses word files. R...

Design an application that opens and analyses word files. Requirements: Create an application that analyses text documents. It should open a text file, read each word into an ap

.net windows services, .NET Windows Services But Enthusiasm has an amazi...

.NET Windows Services But Enthusiasm has an amazing record of beginning overdue but finding up easily. This is real in situation of .NET too. Enthusiasm put their best men at

What is the switch statement, What is the switch Statement? This is a dif...

What is the switch Statement? This is a different form of the multi way decision that It is well structured, but can only be used in certain cases where: 1. Here, Only one var

Java swing, Expertsmind brings you unique solution in java assignments ...

Expertsmind brings you unique solution in java assignments Swing Move is the primary Java GUI gadget tool set. It is part of Oracle's Java Groundwork Sessions (JFC) - an A

Api in c#, i what to know how setcapture() api work in c#

i what to know how setcapture() api work in c#

Cobol program, need someone to write a simple cobol program for me..urgent

need someone to write a simple cobol program for me..urgent

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd