title: Expect command not found in script
body: <p>I have installed expect command on CentOS 7 with <code>yum install expect -y</code>. I want to automate some input in my script but it seems like it doesn't interpret in bash anymore.</p>
  
  <p>Here is my script :</p>
  
  <pre><code>#!/usr/bin/expect -f
  homeDir="/home"
  
  if [ $# -eq 1 ]; then
      CLIENT="$1"
      ./easyrsa build-client-full "$CLIENT" nopass
  elif [ $# -eq 2 ]; then
      CLIENT="$1"
      password="$2"
      set timeout -1
      spawn ./easyrsa build-client-full "$CLIENT"
      expect "Enter PEM pass phrase:"
      send -- "$password"
      expect eof
  else
      echo "script &lt;username&gt; &lt;password (optional)&gt;"
  fi
  </code></pre>
  
  <p>I made the script executable with <code>chmod +x script</code> and run it like <code>./script</code>.
  The error I get :</p>
  
  <blockquote>
    <p>script: line11: spawn : command not found couldn't read file "Enter
    PEM pass phrase:": no such file or directory 
    script: ligne13: send :
    command not found couldn't read file "eof": no such file or
    directory</p>
  </blockquote>
  
  <p>If I make <code>whereis expect</code></p>
  
  <p>I get :</p>
  
  <pre><code>expect: /usr/bin/expect /usr/share/man/man1/expect.1.gz
  </code></pre>
  
  <p>I would like to ask if there is some alternative without using another lib ?</p>
  
  <p>I also tried using this line of code but this doesn't give any return :</p>
  
  <pre><code>echo "$password" | ./easyrsa build-client-full "$CLIENT"
  </code></pre>