title: Bash Read Input - Tab the Prompt
body: <p>I've got a script that I'm reading the input from users. Here's my code:</p>
  
  <pre><code>if [ -z $volreadexists ]; then
          echo -e "\tThis will overwrite the entire volume (/dev/vg01/$myhost)...are you sure?"
          read REPLY
          echo
          if [[ $REPLY =~ ^[Yy]$ ]]; then
              echo -e "\t\tContinuing"
              syncvolume
          else
              echo "Fine...skipping"
          fi
      fi
  </code></pre>
  
  <p>I'm having to use <code>read REPLY</code> because <code>read</code> by itself doesn't insert tabs. What I'm looking for is something similar to:</p>
  
  <pre><code>read -p "\tDoes this look OK? (n for No)" -n 1 -r
  </code></pre>
  
  <p>Where <code>\t</code> would tab over the read prompt.</p>
  
  <p>How can I add tabs to a read prompt?</p>
  
  <p>UPDATE: Thanks for the great answer from @gniourf!:</p>
  
  <pre><code>read -p $'\tDoes this look OK? (n for No)' -n 1 -r
  </code></pre>
  
  <p>However, I found an issue. When I attempt to use a variable there it doesn't translate it:</p>
  
  <pre><code>read -p $'\tThis will overwrite the entire volume (/dev/vg01/$myhost)...are you sure? ' -n 1 -r
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>        This will overwrite the entire volume (/dev/vg01/$myhost)...are you sure?
  </code></pre>
  
  <p>where I want:</p>
  
  <pre><code>        This will overwrite the entire volume (/dev/vg01/server1)...are you sure?
  </code></pre>
  
  <p>Using doublequotes doesn't work either :(</p>
  
  <p>Any ideas?</p>