Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell script to find how many terminals has this user logged in

Posted By: Von Fischer     Category: Unix / Linux / Ubuntu     Views: 14085

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

Code for Write a shell script to find how many terminals has this user logged in in Unix / Linux / Ubuntu

if [ $# -eq 1 ]
    then
            who>user.lst
            echo "$1 User is logeed at "
            grep -c $1 user.lst
    else
            echo "Pls enter User Name"
    fi

--------------------------------------------------------------------------------            

OUTPUT:
    $ sh15 testuser
          testuser User is logeed at 1    
________________________________________________________________________________
  
Share: 



Von Fischer
Von Fischer author of Write a shell script to find how many terminals has this user logged in is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
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!