How to match single character on bash script
<p>I want to write a bash script to read an input from user and check whether the input matches a single character. Below is the code.</p>

<pre><code>read letter

if [[ $letter  =~ ([a-zA-Z]) ]]
then
        echo correct
fi
</code></pre>

<p>When I input two characters it still says "correct", see below output:</p>

<pre><code>$ sh tmp.sh 
aa
correct
</code></pre>

<p>how to write regular expression to matches exactly one character?</p>