How to get invalid user input into a variable
I have a script in which it searches the password file for a username based on the user's input. Is there a way I can take the bad input and keep it in a variable. (one that keeps adding all the non-existent users)
this is what I have so far
echo -n "Enter username: "
grep -i "$username" /etc/passwd || echo "User not found."
so how would I get non-existent users into another variable?
thanks a lot!