![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| a simple loop in csh | dsstamps | UNIX for Dummies Questions & Answers | 1 | 05-22-2008 12:03 AM |
| simple while loop | ali560045 | Shell Programming and Scripting | 10 | 12-26-2007 07:44 AM |
| Simple loop query | kutz13 | UNIX for Dummies Questions & Answers | 2 | 07-17-2007 12:13 PM |
| Simple while loop question | Brokeback | Shell Programming and Scripting | 3 | 07-21-2006 06:04 AM |
| a simple while loop | syno | Shell Programming and Scripting | 5 | 04-08-2006 03:45 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
simple for loop
i have the following process running in background:
when i give "ps -lef" ------------------------------------------------------------------------ user2 user1 user1 user3 user1 user4 user5 user4 user3 user4 user2 user1 user1 user3 user1 user4 user5 user4 user3 user4 ---------------------------------------------------------------------- i have the script #!/bin/ksh for i in user1 user2 user3 user4 user5 do count=0 ((count=`ps -lef | grep -c $i` - 1)) echo $i ech $count done ------------------------------------------------------------------- its giving o/p as user1 6 user2 2 user3 4 user4 6 user5 2 --------------------------------------------------------------- i want to use only "user" in "for" loop as -------------for i in user----------------- and it should count the user for 1 to 5.. can u help me in this.....is there any way Last edited by ali560045; 12-13-2007 at 11:47 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
still not getting the o/p
|
|
#3
|
|||
|
|||
|
What o/p are you expecting? Your question makes no sense. What is the point of the for loop if you are only passing in a string called "user"?
for i in 1 2 3 4 5 makes sense, not for i in user. |
|
#4
|
||||
|
||||
|
look i want to just access user1............................user5,by just writting user in for loop..........
i m not getting how to use this logic in my for loop |
||||
| Google The UNIX and Linux Forums |