Monday, 30 September 2013

help with bash, password delete script

help with bash, password delete script

I would like to make a script that deletes a directory with 'rmdir' after
confirming with a password useing '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.

No comments:

Post a Comment