I am trying to make a simple script that would move junk files into a bin like directory.
The code i wrote is here:
echo "Which file/s you want to delete?"
read fileName
if [ -d "/home/user/.waste"]
then
#moves the file to .waste
mv $fileName /home/user/.waste
echo "File deleted."
else
#creates the directory
mkdir /home/user/.waste
mv $fileName /home/user/.waste
echo "waste bin created and file deleted."
fi
When i run the script while having the directory it keeps going to the else option and does not recognize the value i entered in the if statement.