The question was to write a script that checks whether the character read is "Y", "y","n" or "N", and display the result accordingly.
However, I'm getting the output YES for every input I give. I'm a complete novice in scripting and can't figure out what might be causing this.
Here's the code:
#!/bin/bash
read CHAR
if [ [$CHAR=="Y"] -o [$CHAR=="y"] ]; then
echo "YES"
elif [ [$CHAR=="N"] -o [$CHAR=="n"] ]; then
echo "NO"
fi