Script works on Solaris, not on Linux

I'm in the same boat as Barbus - same exercis (http://www.unix.com/shell-programming-scripting/43609-processes-users.html\)

The following script works on a solaris server I have access to. It doesn't however, work on the companies Linux machine. Any idea what's up? I have very little shell experience, and I can't seem to get this to work. Someting really obvious I'm missing that you vets can spot a mile off?

#!/bin/bash
#set -x

w | cut -d ' ' -f1 | sort -u | while read userID
do
while IFS=: read userIDpasswd junk junk junk userName junk
do
if [ "${userID}" = "${userIDpasswd}" ]; then
echo "userID->${userID} userName->${userName}"
ps -U ${userID}
fi;
done < /etc/passwd
done

Any help would be appreciated :slight_smile:

do

# w

on solaris and compare the output to linux... if there are any differences your script will not give the expected output...