Headlines
Program in UNIX to find out at how many terminals has this user logged in

Program in UNIX to find out at how many terminals has this user logged in

While executing a shell script either the LOGNAME or the UID is supplied at the command prompt. Write a shell script to find out at how many terminals has this user logged in.

echo "Enter the LOGNAME"
read lgname
x=`who | grep $lgname | wc -l`
if [ $x -eq 0 ]
then
    echo "user name did not logged"
fi
echo "Number of terminal $lgname has logged in is $x"
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***