Last active
February 2, 2023 02:46
-
-
Save rsperl/d578646cccd0c951ef568fa12f9e3b41 to your computer and use it in GitHub Desktop.
Revisions
-
rsperl revised this gist
Jul 25, 2022 . No changes.There are no files selected for viewing
-
rsperl revised this gist
Aug 4, 2021 . No changes.There are no files selected for viewing
-
rsperl revised this gist
Aug 4, 2021 . No changes.There are no files selected for viewing
-
Richard Sugg revised this gist
May 24, 2018 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,0 @@ -
Richard Sugg revised this gist
May 23, 2018 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ .gitignore .gistinfo.json -
Richard Sugg revised this gist
May 23, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
rsperl revised this gist
Sep 16, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,8 @@ IFS=$'\n\t' action=${1:-"default value"} tmpdir=$(mktemp -d "${TMPDIR:-/tmp/}$(basename $0).XXXXXXXXXXXX") # write to stderr err() { echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2 -
rsperl revised this gist
Jul 30, 2017 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,15 @@ #!/bin/bash # see also # - Google's Shell Style Guide: https://google.github.io/styleguide/shell.xml # - ShellCheck: https://github.com/koalaman/shellcheck # src: # - http://hackaday.com/2017/07/21/linux-fu-better-bash-scripting # - https://dev.to/thiht/shell-scripts-matter # exit if any line fails (you can do command_fails || true, and the script continues) set -o errexit set -euo pipefail # -e exit if any command returns non-zero status @@ -11,6 +20,11 @@ IFS=$'\n\t' action=${1:-"default value"} # write to stderr err() { echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2 } readonly LOG_FILE="$(basename "$0").log" info() { echo "[INFO] $@" | tee -a "$LOG_FILE" >&2 ; } warning() { echo "[WARNING] $@" | tee -a "$LOG_FILE" >&2 ; } -
rsperl created this gist
May 31, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/bash # https://dev.to/thiht/shell-scripts-matter set -euo pipefail # -e exit if any command returns non-zero status # -u prevent use of undefined variables # -o pipefail force pipelines to fail on first non-zero code IFS=$'\n\t' action=${1:-"default value"} readonly LOG_FILE="$(basename "$0").log" info() { echo "[INFO] $@" | tee -a "$LOG_FILE" >&2 ; } warning() { echo "[WARNING] $@" | tee -a "$LOG_FILE" >&2 ; } error() { echo "[ERROR] $@" | tee -a "$LOG_FILE" >&2 ; } fatal() { echo "[FATAL] $@" | tee -a "$LOG_FILE" >&2 ; exit 1 ; } cleanup() { info "### finished" } if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then trap cleanup EXIT info "### starting" # Script goes here # ... fi