Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
-
The problem statement, all variables and given/known data:
I have to write a program which can tell me how many processes is running by some user, from the /etc/passwd file
it should look like this:
root 50
me 55
other 2 -
Relevant commands, code, scripts, algorithms:
cut, pgrep -
The attempts at a solution (include all code and scripts):
i have done this so far but it just gives me the sum of all processes running on all users:
user=$(cut -d: -f1 /etc/passwd)
process=$(( pgrep -cu $user))
echo -e "$user"
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
University of Ljubljana, Ljubljana, Slovenia, Janez Novak, ID63709
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).