anchor.diff:    </tbody>
   </table>
   
  -Most build scripts should set the `-e` and `-o pipefail` options to ensure if any command fails your entire build script fails. For example:
  +In the majority of cases, you will want to ensure that if any one command fails your entire build script fails. You can set up your script to do this automatically by using the `-e` and `-o pipefail` options. For example:
   
   ```bash
   #!/bin/bash
  
positive.code: # Writing Build Scripts
  
  Steps in your build pipelines are most often just shell scripts that are checked in alongside your code. The [Buildkite Agent](/docs/agent) will run your scripts, capture and report the log output, and use the exit status to mark the build as passed or failed.
  
  <%= toc %>
  
  
negative.code: 
  If you are getting too much logging in your build output, there are several strategies you can employ to reduce it. Take a look at our guide to [managing log output](/docs/builds/managing-log-output) for a step by step introduction. 
  
  ## Debugging your environment
  
  The first step in debugging your build script is outputting the environment information. This will show any [environment variables](/docs/builds/environment-variables) set up by the Buildkite Agent, as well as other important environment variables such as `$PATH`.
  
  To add the environment to your build output execute `env` at the start of your build script.
  
  ```
  #!/bin/bash
  
  env
  ```
  
  You can also set the `-x` option which will execute all subequent commands in 'debug' mode. This will step through the script and print a line for each operation it performs. If you'd like to debug some commands but not others, you can turn debugging off again with `set +x`.  
  
  ```
  #!/bin/bash
  
  set -x
  tests.sh
  set +x
  
  run.sh
  ```
  
  For more information about the `-x` option and debugging in general, see the [Bash Guide for Beginners' page on debugging bash scripts](http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html).
  
  ## Help Tools - Linting and Debugging
  
  To check your shell scripts for common errors and mistakes you can use a linting tool like [Shellcheck](http://www.shellcheck.net). [Shellcheck](http://www.shellcheck.net) is a shell script linter with a web-based front-end and a command line tool. It can also be used directly in your code editor.
  