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
how do i make a bomber game using pascal on a software called lazuras

Why no Audible support for Linux? Maybe they should use a browser interface?

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


Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

Version Control is a critical tool in development and production environments that allows a user to make snapshots of working con?gurations or code. In this assignment, you will de

Problem 1 Define the architecture of UNIX operating system with appropriate diagram Problem 2 Define the term inter-process communication. What are several approaches t

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

Question: (a)  An HTML file "decor.html" uses an external Cascading Style Sheet file name  "nicedesign.css". Users are viewing the Web page making use of different kinds of  br

Advantages of java stored procedures Transactions Although a saved process contains SQL orders, once collected it will socialize with SQL Hosting server very diversely from