title: PHP, shell_exec and an input
body: <p>is it possible for shell_exec to execute a given command, where the initial command would ask the for a dynamic input then followed by a command that's based on the input itself.</p>
  
  <p>i've researched for hours for the answer and i can't seem to find what i'm looking for.</p>
  
  <p>i have a requirement that's similar to the idea of the example below and any help would be appreciated since </p>
  
  <p><code>$x = shell_exec("read -p 'Enter your name : ' x; echo 'Your name is' : $x");</code></p>
  
  <p>echoing x outputs : </p>
  
  <p><em>your name is</em> </p>
  
  <p>as you can see i'm running multiple commands, but i do not know where i can insert inside the string command for the input.</p>
  
  <p>note : 
  i tried doing</p>
  
  <p><code>$x = shell_exec("echo 'Foo' | read -p 'Enter your name : ' x; echo 'Your name is :' $x");</code></p>
  
  <p><code>echo $x;</code></p>
  
  <p>output was :</p>
  
  <p><em>Your name is :</em> </p>
  
  <p>i was expecting like</p>
  
  <p><strong>Your name is : Foo</strong></p>
  
  <p>clearly, something is wrong.</p>