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
Write a program that repeatedly prompts for and reads a positive integer value n and then calculates and displays the nth Fibonacci number

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

#question. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Description: *

Implement a two-dimensional table in Prolog. Your program will contain: An insert_entry predicate that takes a table, row, column and an entry and inserts the entry at the g


Plan, design and dry run a program for the Little Man Computer (LMC) that produces the same result using a fixed number of 10 iterations.

Man, i''m having quite a problem with this exercise. Even googled for Roman multiply table concept. I just don''t get it. Multiply two numbers given in Roman figures. For instan

Create a single page that demonstrates an XHTML form. The form should include all the fields you feel are necessary for submitting an order of books and must include at least one

We need Advancement in Existing PhoneGap Application We need a PhoneGap expert to aid us extend an existing PhoneGap application. The app works pulls data from a new website (de

write c++ source code to find the number of digits in a given integer? pls ans