I would like to make a script that deletes a directory with rmdir
after confirming with a password using read
to set the variable.
So far I have this:
#!/bin/bash -x
echo "Password:"
read -t 30 S1
S2='55555'
if [ $S1=$S2 ]; then
rmdir /home/william/test
else
echo "fail"
sleep 10
fi
So, I have the -x
to try to debug it but every time the script either fails to echo (if I put the password in wrong) or it wont remove the directory needed.
If someone has a modifiable script that I could use or if you could point out the problems with the current script that would be great.