I don't understand why the last part of my script does not display anything when no file or directory is found.
echo -n "Please enter a filename or directory: "
read filename
if [ -z "$filename" ]; then
echo "You did not enter anything!"
exit 1
fi
if [ -e "$filename" ]; then
if [ -f "$filename" ]; then
echo "You entered a file."
elif [ -d "$filename" ]; then
echo "You entered a directory."
else
echo "You did not enter a valid file or directory."
fi
fi
exit
I don't know what's wrong with my code. It will not display the echo if an invalid or nonexistent file or directory is inputted.