title: Bash script code explanation
body: <p>I am looking into the fast.ai course (deep learning for coders). One of their bash scripts to setup an instance in AWS, has this line of code that I am failing to understand (albeit knowing what it does):</p>
  <p><a href="https://i.stack.imgur.com/QfP3Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QfP3Z.png" alt="enter image description here" /></a></p>
  <p>I am quite certain, that this calls another bash script in the same directory. But there are six things I would like to understand/clarify:</p>
  <ol>
  <li><p>Q1</p>
  <p>Why is there a . before $(dirname &quot;$0&quot;)</p>
  </li>
  <li><p>Q2</p>
  <p>What is the difference between &quot;$0&quot; and $0, are you forcing the output in the fist case to be converted into a string?</p>
  </li>
  <li><p>Q3</p>
  <p>I checked what dirname &quot;$0&quot; does by echoing it into my command line. It looks like it gives the name of the shell? So in my case (using Cygwin and executing: <code>echo &quot;$0&quot;</code>), it prints &quot;-bash&quot; to the console.</p>
  </li>
  <li><p>Q4</p>
  <p>What does dirname do?</p>
  </li>
  <li><p>Q5</p>
  <p>What is the value of $(dirname &quot;$0&quot;)?</p>
  </li>
  <li><p>Q6</p>
  <p>Will the variables: $region,$ami and $instanceType be transferred into setup_instance.sh, and why?</p>
  </li>
  </ol>