bashscript 763 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. #
  3. # The following comments are all removed when loading this template:
  4. #
  5. # The Unofficial "Bash Strict Mode"
  6. # -e Failed commands exit
  7. # -u Unbound variables exit
  8. # -o pipefail Do not hide piped-command failures
  9. # IFS as newline and tab are better for loops (and name with spaces).
  10. #
  11. # Tips:
  12. # - Options can be switched off and on as required:
  13. # - Toggle `-e` if previous command's return value is needed (`$?`).
  14. # - Toggle `-u` if sourcing another non-conforming script.
  15. # - Use default values for positional parameters i.e. `${1:-}`.
  16. # - Intentionally undefined variables should be set to "" rather than not set.
  17. # - Learn about "exit traps" to perform `try-catch-finally`-like cleanup tasks
  18. #
  19. set -euo pipefail
  20. IFS=$'\n\t'