This file contains 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 characters
#!/usr/bin/env bash | |
#shellcheck disable=SC2034 | |
# Comments prefixed by BASHDOC: are hints to specific GNU Bash Manual's section: | |
# https://www.gnu.org/software/bash/manual/ | |
## Makes debuggers' life easier - Unofficial Bash Strict Mode | |
## http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
## BASHDOC: Shell Builtin Commands - Modifying Shell Behavior - The Set Builtin | |
### Exit prematurely if a command's return value is not 0(with some exceptions), triggers ERR trap if available. | |
set -o errexit |
This file contains 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 characters
# Prompt for Yy/Nn, if not the expected answer ask again | |
# Parameter: A string of prompt; Default answer(Y/N) | |
# return 0 for yes and 1 for no | |
prompt_yes_or_no(){ | |
if [ ${#} -ne 2 ]; then | |
printf --\ | |
'Fatal: %s: Function paramater quantity mismatch! Please report bug\n'\ | |
"${FUNCNAME[0]}"\ | |
1>&2 | |
exit 1 |
OlderNewer