Last active
February 1, 2019 19:20
-
-
Save bertvv/7727082 to your computer and use it in GitHub Desktop.
Simple Bash script template
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 | |
# | |
# Script name -- purpose | |
# | |
# Author: | |
set -o errexit # abort on nonzero exitstatus | |
set -o nounset # abort on unbound variable | |
# | |
# Functions | |
# | |
usage() { | |
cat << _EOF_ | |
Usage: ${0} | |
_EOF_ | |
} | |
# | |
# Variables | |
# | |
# | |
# Command line parsing | |
# | |
if [ "$#" -ne "1" ]; then | |
echo "Expected 1 argument, got $#" >&2 | |
usage | |
exit 2 | |
fi | |
# | |
# Script proper | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Waarom moeten wij in line 30 de stdout dwingen naar stderr ? Heeft het echt nut?