I am busy making a function that gives the user a yes or no question. However I seem to be making a mistake with my script.
#!/bin/bash
read -p "Test, enter y or n: " choice
echo "$choice"
if [ "$choice"==y ]
then
echo "you choose $choice"
else
echo "you did not choose y"
fi
This always seems to return You choose y|n
, despite the fact that I expect it to return you did not choose y
.
I have been searching for a while now and tried to solve it using double brackets, no brackets, quotes, no quotes.