title: spawn: command not found when I use expect to ssh login my remote server
body: <p>In my Mac, I have installed <code>expect</code>:</p>
  
  <pre><code>$ brew install expect 
  Updating Homebrew...
  Warning: expect 5.45.3 is already installed
  </code></pre>
  
  <p>I write a bash script on my Mac:</p>
  
  <pre><code>#!/usr/bin/expect -f  (there I tried #!/bin/bash too)
  set timeout 60
  set host 103.212.12.76
  set name root 
  set password my_password
  
  spawn ssh $host -l $name 
  
  expect {
      "(yes/no)?" {
          send "yes\n"
          expect "password:"
          send "$password\n"
      }
      "password:" {
          send "$password\n"
      }
  }
  
  expect "#"
  # test whether login to host
  send "uname\n"
  expect "Linux"
  send_user "Now you can do some operation on this terminal\n"
  
  interact
  </code></pre>
  
  <p>But when I execute my script on my Mac, I get error:</p>
  
  <pre><code>$ ./test01.sh 
  ./test01.sh: line 11: spawn: command not found
  couldn't read file "{": no such file or directory
  ./test01.sh: line 14: (yes/no)?: No such file or directory
  ./test01.sh: line 15: send: command not found
  couldn't read file "password:": no such file or directory
  ./test01.sh: line 17: send: command not found
  ./test01.sh: line 18: syntax error near unexpected token `}'
  ./test01.sh: line 18: ` }'
  </code></pre>
  
  <p>It report <code>spawn: command not found</code>, but I installed the expect in my Mac. </p>
  
  <p>I also tried change the <code>test01.sh</code> name to <code>test01.exp</code>, not work too.</p>
  
  <pre><code>./test01.exp 
  ./test01.exp: line 11: spawn: command not found
  couldn't read file "{": no such file or directory
  ./test01.exp: line 14: (yes/no)?: No such file or directory
  ./test01.exp: line 15: send: command not found
  couldn't read file "password:": no such file or directory
  ./test01.exp: line 17: send: command not found
  ./test01.exp: line 18: syntax error near unexpected token `}'
  ./test01.exp: line 18: `    }'
  </code></pre>