here's a simple example to get started with, it shows how to check if an argument was given and
how to get the username from /etc/passwd, the prompting and looping would have to be added.
Code:
#!/bin/bash
if [ $# = 0 ] ; then
echo Usage $0: {userid}
else
userid=$1
echo username=`grep ^${userid}: /etc/passwd | awk -F: '{print $5}'`
fi
this assumes that the layout of /etc/passwd on your machine follows the same format
where column 5 (delimited by colons) is the user name