The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 05-14-2008
kartikkumar84@g kartikkumar84@g is offline
Registered User
 

Join Date: May 2008
Posts: 16
hi era

I am used to programming in Matlab and C++ and in these languages you can refer to individual members of a variable (array) and compare their values to all the other members using 2 loops. how can i accomplish that in unix. For example

var2=$(users)

will return the current users but if a user is running two instances of a shell then that username will be returned twice. How can i trim the varible $var2 so that multiple occurrences of usernames are eliminated. i can use a for loop to loop through each member of the varible but then how do i compare it to the rest of the usernames in $var2.

I am referring to tutorials as well but most of them jus explain the general syntax of commands. i guess i am not referring to the right ones, will work on tht.
Reply With Quote