ok I'm a newb at this so I'm not sure if I'm doing this right. Any suggestions would be appreciated. I need to make a script that takes in a userid as an argument. it then takes the userid to obtain the user's name from the /etc/passwd file with the cut command. it should then prompt if the user wants to enter another userid. if yes, then it'll repeat the script, if no, then it'll end. Thanks
#!/bin/bash
echo
===================================================================
echo Welcome to Linux Login
echo Created by RC
echo ===================================================================
answer=y
while [ "$answer" = "y" ]; do
if [ $# = -lt 1 ]
then
echo -n "Enter userid: "
read userid
fi
if [ "$1" ]; then
x=$1
else
user=$userid
new=$(grep $userid /etc/passwd | cut -f5 -d
echo $new
echo "Would you like to enter another userid? (y)es or (n)o"
if [ "answer" != "y" ]
then
read answer
fi
done