answersLogoWhite

0


Best Answer

#!/bin/sh

echo "Please enter the name of a user:"

read USER

who|grep $USER > /tmp/usertest &

sleep 5

if [ -s /tmp/usertest ]

then echo "User is logged in"

else echo "User is not logged in"

fi

rm /tmp/usertest

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a unix shell program to accept a user name and check whether the user logged in or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program to accept 2 numbers and tell whether the product of the two number is equal to or greater than 1000?

C programm


How do you write BASIC program to accept variables?

dim a input a


Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


How to write a program to accept the user name and password and then shop this is your Password?

you cant


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


Write a c program to accept name and store the name in its short form?

happy birthday...


Write a program to accept name and store the name in it's short form as eg sikkim manipal university SMU?

Write a program to accept name and store the name in its short form (e.g. Sikkim Manipal University should be stored as SMU)


Write a program in 'C' language to accept 6 strings as input and print them in lexicographic?

(ab)*b


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


Write a shell program called whos to display a sorted list of the logged in usersJust display the user names and no other information?

The 'users' command should do that; you don't need to write a shell script to get that information in that format.


How can you write an explanation letter for lacking of proof of employment?

You can write a simple letter stating why you don't have proof of employment. It will be up to the company whether they accept your letter or not.


How do you write a program in visual foxpro?

Same with other Visual Basic program, programming in FoxPro will require you to have the right syntax.