Adds "-h" option to display usage guide

This commit is contained in:
C-Duv 2017-02-11 14:58:03 +01:00
parent 6cb0faca60
commit 3304fde7a3
2 changed files with 23 additions and 5 deletions

View File

@ -19,8 +19,11 @@ send-notification.sh "All your base are belong to us"
uptime | send-notification.sh uptime | send-notification.sh
``` ```
See `send-notification.sh -h`.
### Configuration : ### Configuration :
Script can be configured
Edit `send-notification.sh` and set the following variables: Edit `send-notification.sh` and set the following variables:
* `USER_LOGIN` * `USER_LOGIN`

View File

@ -8,10 +8,25 @@
# #
# Nécessite: sed, sh et wget # Nécessite: sed, sh et wget
# #
# Possible usages: # Possible usages: see usage_help()
# send-notification.sh "All your base are belong to us"
# echo "All your base are belong to us" | send-notification.sh
# uptime | send-notification.sh readonly PROGNAME=$(basename $0)
usage_help () {
echo "Possible usages:"
echo "* ${PROGNAME} [options] [message]"
echo "* echo \"All your base are belong to us\" | ${PROGNAME} [options]"
echo ""
echo "Options:"
echo "* -h display this help"
}
while getopts "h" option; do
case "$option" in
h) usage_help ; exit 0 ;;
esac
done
## ##