Hacker News new | past | comments | ask | show | jobs | submit login
The first two statements of your BASH script should be (ashishb.net)
13 points by mooreds on April 15, 2020 | hide | past | favorite | 4 comments



  #!/bin/sh
  # don't need bash for this


  /bin/dash: 2: set: Illegal option -o pipefail


Space between "#!" and the path lets the text breathe :-)

    #! /usr/bin/env bash
    set -euo pipefail


A couple years ago I switched to doing "set -eu" in all my shell scripts and have been quite happy with it. While developing the script I'll also often add "set -xv" for debugging.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: