title: Do exec() calls fork for each command if passed a shell script?
body: <p>For each command in a shell script passed to exec(), is it forked and ran in a child process?
  Say I have a shell script called test.sh with the following contents;</p>
  
  <pre><code>#!/bin/bash
  
  echo Hello
  echo There
  </code></pre>
  
  <p>What I want to know is how the series of commands is treated if I were to call execvp() on test.sh in a C program.</p>
  
  <p>For each command within the script, is there a fork followed by another exec call on that command, before a return to the parent and a repeat for the next command?</p>
  
  <p>So far I have used strace on this exact example. My findings are that if I put two echos into the script, there are no calls to clone() (which I believe equates to forking?), but if I put two separate cats as such: </p>
  
  <pre><code>#!/bin/bash
  
  cat file1
  cat file2
  </code></pre>
  
  <p>Then I find two calls to clone in the strace. At the same time, stracing a singular cat call on its own, without running it from an execvp call on a shell script, does not yield any clones in the strace.</p>
  
  <p>I would really appreciate a clarification on the way which exec calls handle shell scripts.</p>