Being newbie in linux shell scripting, I had tried to implement the following code in test.sh
:
#!/bin/sh
# This is some secure program that uses security.
clear
VALID_PASSWORD="secret" #this is our password.
echo "Please enter the password:"
read PASSWORD
if [ "$PASSWORD" == "$VALID_PASSWORD" ]; then
echo "You have access!";
else
echo "ACCESS DENIED!";
fi
But while executing the script, it shows me following error:
Please enter the password:
1234
./tst1.sh: 9: [: 1234: unexpected operator
ACCESS DENIED!
I am unable to debug this error. Appreciate the much needed help.