title: What is the difference between `./example.sh` and `sh example.sh`
body: <p>I am trying to play with bash and arrays. But executing a sample script, I got an unexpected syntax error message: <code>example.sh: 3: example.sh: Syntax error: "(" unexpected</code>. And this is the script</p>
  
  <pre><code>#!/bin/bash
  array=( one two three )
  </code></pre>
  
  <p>If I run the script with ./example.sh it works and no errors are displayed. But if I run <code>sh example.sh</code> I get the error message.</p>
  
  <p>I thought that these two commands are the same:</p>
  
  <ul>
  <li>sh example.sh</li>
  <li>./example.sh</li>
  </ul>
  
  <p>so ... what is the difference between the two?</p>