I'm trying to create a yes/no prompt within a shell script that I'm making for someone else and it's starting to get irritating right now... I've been up and down the forums, checked my 833 page PDF book on Bash/Shell scripting for reference and I can not get this to work at all...
Every time I build a script with various aspects to it I test it out piece by piece. I usually use Zenity for prompts and other scripts, but this is for someone who doesn't have it installed on their system. So far everything works until the yes/no prompt here.
Here's the NOT WORKING test prompt:
My terminal output is
read -p "Yes or no? If you don't know please type 'no': " prompt
if [ $prompt == [Yy][Ee][Ss] ] ; then
#Execute desired command if user agrees.
printf "Thank you, please wait one moment \n"
printf "Everything worked just fine without any errors, have a nice day!"
#Exit if user decided against the action
printf "Thank you for your time, have a nice day \n"
The crazy thing is, I tested the function which works, I tested it using my zenity prompt, but as soon as I use my prompt above, it stops working!
test.sh: 3: [: yes: unexpected operator
No worked just fine
Can anyone offer me some help or suggestions?