Use color and variables in read command
<p>I want to have a colored prompt in bash.
Usually, I do this like this, for example:</p>

<pre><code>read -p $'\033[1;32m hello world?' helloWorld
</code></pre>

<p>This works fine, but no variables are expanded in the prompt string. Now I want color and expanded variables, but this does not work:</p>

<pre><code>read -p $'\033[1;32m hello $thisVariableIsNotExpanded ?' helloWorld
</code></pre>

<p>I tried just using <code>echo -e</code> instead of <code>read -p</code>, but this adds a linebreak which I do not want.</p>

<p>So, how can I have colors and variable expansion in a read prompt?</p>