How can I hide the command not found in my bash script? Im curious because everything works great except the sloppy "command not found message"
read user_name
if $user_name && exit 2> /dev/null
then
exit 0
elif egrep "^${user_name}": /etc/passwd 2> /dev/null
then
finger $user_name
exit 0
elif
until egrep "^${user_name}:" /etc/passwd || $user_name && "exit" 2> /dev/null
do
echo "try again or type exit to quit"
read user_name
if egrep -i "^${user_name}": /etc/passwd
then
finger $user_name
fi
done
then
finger $user_name
exit 0
fi
This is the error im getting
./project.sh: line 49: (myusernameisherebutimhidingit): command not found
if $user_nameis supposed to do, but if you want to say "if$user_nameis non-empty" you should useif [ -n "$user_name" ].