Yes/No Then Follow Command

Hello Guys,

I'm currently creating a script for a couple of things and I'm semi stuck on where to go next.

This is the script i've written but its not working in the exact way i want it to work.

#!/bin/bash

while :
do
clear
echo " M A I N - M E N U"
echo "1. Make a New Directory"
echo "2. Safely Delete a File"
echo "3. List Out the Contents of a File"
echo "4. Display the Full name of Any User"
echo "5. Display The Current Date"
echo "6. Display the Disk Usage"
echo "7. Show who is logged on"
echo "8. Show User Processes"
echo "9. Display The logfile"
echo "0. Exit"
echo -n "Please enter option [0 - 9]"
read opt
case $opt in
1) echo "Make a New Directory, Enter a New DIR NAME please $USER";
read "dir_name";
mkdir $dir_name;
if [-d $dir_name];
then echo "$dir_name Has been created";
else echo "$dir_name Hasn't Been Created";
fi;;
2) echo "Please Type in a File that you want to delete";
read "fname";
echo -n "Do you want to Safely delete this file? $fname";
echo "...";
read "response";
if [ $response = "y"-o $response = "YES" -o $response = "Yes" ];
then rm -r $fname;
else
echo "File Not Deleted";
fi;;
# 3)
# 4)
# 5)
# 6)
7) echo "This Is Who Is Currently Logged";
who | more;;
# 8)
# 9)
# 0)

esac
done

My Problem is that when taking a response from option number 2 it will delete a file if there is any but won't continue to echo for a wrong response.
I also want to add an echo if the File has been deleted when u confirm to delete the file.

I would also respect it if there are ways to simplify this script, I'm a beginner at Shell Scripting and have picked it up quite fast so any basic that can be explained because im not likely to understand anything more advanced.

Thank you for any help :slight_smile:

rm -r $fname  2>/dev/null

if [ $? -eq 0 ] ;then
echo "file deleted"
else
echo "no such file"
fi