this post was submitted on 15 Jun 2023
20 points (100.0% liked)

commandline

1785 readers
1 users here now

founded 2 years ago
MODERATORS
 

Any extra tips or tricks are welcome!

Yesterday I learned that set -x enables trace for a bash, sh, or zsh script and prints the trace to the terminal.

you are viewing a single comment's thread
view the rest of the comments
[–] RandomDevOpsDude 3 points 2 years ago* (last edited 2 years ago)

I write a lot of bash scripts that end up running in automation in some fashion.

#!/usr/bin/env bash

set -euxo pipefail

Is pretty standard for me.

-e exit on error

-o pipefail exit on pipeline fail

-u error on unset variables

-x trace