title: error "sh: 1: read: Illegal option -d" when using here-document in system command run from Python
body: <p>I'm running a Bash system command from within Python and have encountered this problem when using <code>read</code> to define a here-document in the command:</p>
  
  <pre><code>import os
  text     = "~|||-:this is text:-|||~"
  fileName = "sound.wav"
  command  =\
      "IFS= read -d \'\' text &lt;&lt;EOF\n" +\
      text + "\n" +\
      "EOF\n" +\
      "echo \"${text}\" | text2wave -scale 1 -o " + fileName
  os.system(command)
  </code></pre>
  
  <p>Could you help me figure out how to fix this?</p>
  
  <hr>
  
  <p>Here is a slightly simplified version:</p>
  
  <pre><code>import os
  text     = "~|||-:this is text:-|||~"
  command  =\
      "IFS= read -d \'\' text &lt;&lt;EOF\n" +\
      text + "\n" +\
      "EOF\n" +\
      "echo \"${text}\""                        
  os.system(command)
  </code></pre>
  
  <p>I wanted to make clear in the one above that I'd be using pipes. When I run this, I get the following error:</p>
  
  <p>sh: 1: read: Illegal option -d</p>