Last active
August 9, 2019 08:59
-
-
Save s-petit/8af52ab756e4febe06fe28f6f238ab6a to your computer and use it in GitHub Desktop.
bash script bootstrap
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 characters
| #!/bin/bash | |
| usage="$(basename "$0") [-h --help] [-v A_VALUE] -- bash script description | |
| where: | |
| -h or --help shows this help text" | |
| optspec=":-:" | |
| while getopts "$optspec" optchar; do | |
| case "${OPTARG}" in | |
| h|help) | |
| echo "$usage" | |
| exit 1 | |
| ;; | |
| v) | |
| value="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 )) | |
| YOUR_VALUE=${value} | |
| ;; | |
| esac | |
| done | |
| CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
| cd ${CURRENT_DIR} | |
| #Your code... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment