Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to take LOGNAME or the UID an an input and find how many terminals has this user logged in

Posted By: Vidos Fischer     Category: Unix / Linux / Ubuntu     Views: 5112

Write a shell script to take LOGNAME or the UID an an input and find how many terminals has this user logged in.

Code for Shell script to take LOGNAME or the UID an an input and find how many terminals has this user logged in in Unix / Linux / Ubuntu

uid=$1

if [ $# -eq 0 ]
then
        echo "Enter logname"
        read uid
fi

ch=`who | grep $uid -c`
if [ $ch -eq 1 ]
then
        echo "Logname user loging"else
        echo "Logname user corrent not loging"
fi

echo "Total user are : `who | wc -l`"
  
Share: 



Vidos Fischer
Vidos Fischer author of Shell script to take LOGNAME or the UID an an input and find how many terminals has this user logged in is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!