I am new to shell scripting and have been having issue with the following script password.sh that I copied from a tutorial.
#!/bin/sh
VALID_PASSWORD="secret"
echo "Please enter the password:"
read PASSWORD
if [ "$PASSWORD" == "$VALID_PASSWORD" ]; then
echo "You have access!"
else
echo "ACCESS DENIED!"
fi
In my terminal, I typed ./password.sh to activate the script. When prompted for password, I input password secret but i keep getting ACCESS DENIED. What am I missing?
Also, I thought Variables does not need to be in quotations(only if there are spaces?). For example variable_1=Hello. Why in the script above, VALID_PASSWORD="secret" was in quotation?
Thank You