Wondering if there is an easy way to do what im attempting and the best way to go about something like this.
answer=y
while [ "$answer" = y ]
do
echo "type name of the file you wish to delete"
IFS= read -r file
echo "would you like to delete another file [y/n]?"
IFS= read -r answer
done
echo "Exiting Program"
exit 0
My questions here is when an input is entered it gets stored in file but I would like when the answer is y that it can then get stored to another variable like file1. Im then left with variables containing all the filenames someone wishes to delete which I can echo back.
How can I use a loop in this to keep adding the input until someone types n
Thanks for the help.