I have created a test .rtf file and a test folder to delete from my desktop in Mac OS
Test and Stuff.rtf file
Test and Things folder
Code:
#!/bin/bash
clear
echo Looking for leftovers
echo
STR='~/Desktop/Test and Things';
STR1="~/Desktop/Test and Stuff.rtf";
if [[ -e "$STR" ]]; then
rm -r "$STR";
echo "File $STR found and removed";
else echo "$STR not found!";
fi
echo
if [[ -e $STR1 ]]; then
rm $STR1;
echo "File $STR1 found and removed";
else echo "$STR1 not found!";
fi
I always end up with
~/Desktop/Test and Things not found!