Scripting Help - Display Processes

Hi, I was wondering if somebody could help me as I am struggling with writing a script for a training course.

Ive had to write 5 scripts and this is the last one but am struggling with this even though I understand what it is meant to do.....

PROBLEM: write a script which will allow you to find all users logged on to the system and display the processes they are running. The heading for each user must be their real name not the log in name.

I have identified I need to first use the "finger" command to obtain the full name of a user.

I then need to use ps -u to display the processes info underneath the name of the user.

I believe that this should be added to a while loop which then repeats the process in order to obtain the info for each user.

Please note I am not allowed to use sed or awk for this assignment.

Below is the code I have come up with so far. I think I am getting there but am unsure how to progress. Any help would be appreciated.

#!/bin/bash

name= finger | cut -d' ' -f 2-3 | sort

while read | line
do

echo $name
echo ps -u $line

done

No Homework assignment here.