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

Find out starting address of stack segment, For the following Code answer t...

For the following Code answer the following questions-: .STACK 100H .DATA COUNT DB 10 TOTAL DW 4126H .CODE MAIN PROC MOV BX, 3F20H MOV AL, BL MOV BL, COUNT MOV

Artificial intelligence, Describe briefly how you might program a computer ...

Describe briefly how you might program a computer to exhibit fear or sorrow.

Write a program that prints gross and net pay and taxes , Assume that a vid...

Assume that a video store employee works 50 hours. She gets paid $4.50 for the first 40 hours; she gets time-and-a half pay (1.5 times the regular pay rate) for the first five hour

JSP, can you provide some assignments for JSP learning

can you provide some assignments for JSP learning

Lexical analyzer - xml table output, Lexical Analyzer: Symbol Table - Ho...

Lexical Analyzer: Symbol Table - Holds the symbols accepted by the lexical analyzer or parser.  Each symbol may be a terminal or a non-terminal.  Terminal symbols are listed

Advance operating systems, Project2: A Simple Distributed Computing Platfor...

Project2: A Simple Distributed Computing Platform (Due at 11:59:59pm on 04/12/2012 (EST)) Description: You are asked to develop a replicator (client) that distributes a large job

Maximization, A company produces three sizes of window fans small, medium a...

A company produces three sizes of window fans small, medium and large. the manager has formulated an LP model for fan production Maximize 6x1+8x2+5x3

Shell script to change the permission of a file, Normal 0 false...

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

Understanding the html document object model, At the core of DHTML is the D...

At the core of DHTML is the Document Object Model, or DOM, which represents the HTML or XML of a Web page that is displayed in a browser. The Document Object Model that represents

Just in time compiler, Expertsmind brings you  unique  solution in java as...

Expertsmind brings you  unique  solution in java assignments Just in Time Compiler In processing, just-in-time system (JIT), also known as energetic interpretation, is a m

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