title: How do I make Linux terminal shell out of these instructions?
body: <p>I have been trying to make a .sh script using the instructions to run on the Raspberry Pi for the Atmel ATSAMD51G19A:</p>
  
  <hr>
  
  <ol>
  <li>Launch openocd in a new terminal window:</li>
  </ol>
  
  <p><code>sudo openocd -f openocdcfg.cfg</code></p>
  
  <p>OpenOCD should stay running if it successfully connected to the device.</p>
  
  <ol start="2">
  <li>In a second terminal window, run the following:</li>
  </ol>
  
  <p><code>gdb-multiarch AtmelStart.elf</code></p>
  
  <ol start="3">
  <li>Type these within gdb (say yes when prompted):</li>
  </ol>
  
  <pre><code>target remote :3333
  lo 
  file User.elf
  lo
  mon reset
  </code></pre>
  
  <p>The display device should now be running the ncdisplay code.</p>
  
  <hr>
  
  <p>Now I have no issues flashing the firmware onto the Atmel MCU. I only have issues when creating part 3 of the .sh script.  So far, here is what my script looks like for part 3</p>
  
  <pre><code>(gdb) -ex target remote :3333
  (gdb) -ex lo
  (gdb) -ex file User.elf
  (gdb) -ex y
  (gdb) -ex y
  (gdb) -ex lo
  (gdb) -ex mon reset
  (gdb) -ex q
  </code></pre>
  
  <p><strong>None of the commands listed above will execute within gdb in terminal</strong>.  I'm also unsure how to include 'y' for 'yes' within gdb when making a script.  The terminal just stays idle waiting for the user to type a command.</p>
  
  <p>I am still learning a lot about Linux and Debian/Ubuntu.  In addition, this is the first time I have ever worked with gdb.  Thank you for any help.</p>