Skip to content

Instantly share code, notes, and snippets.

@francoiskha
Last active December 19, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francoiskha/6010235 to your computer and use it in GitHub Desktop.
Save francoiskha/6010235 to your computer and use it in GitHub Desktop.
#!/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