Last active
December 19, 2015 19:59
-
-
Save francoiskha/6010235 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
usage() { cat << EOF | |
Usage: | |
$0 [-v] [-c parametre] mach | |
Description : | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor | |
incididunt ut labore et dolore magna aliqua | |
mach Lorem ipsum dolor sit amet | |
-c parametre : un flag avec un paramètre | |
-v | --verbose affiche toutes les commandes exécutées | |
exemple : | |
$0 i3mach-ser | |
EOF | |
} | |
# parsing des paramètres | |
while true ; do | |
case "$1" in | |
-h|--help) usage ; exit ;; | |
-v|--verbose) VERBOSE=yes ; shift ;; | |
-c) shift ; PARAMETRE_DE_C=$1 ; shift ;; | |
*) break ;; | |
esac | |
done | |
SERVER="$1" | |
if [[ -z $SERVER ]] ; then | |
usage; | |
exit 1; | |
fi | |
# métier | |
echo "ok : ${SERVER}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment