28 lines
708 B
Bash
Executable File
28 lines
708 B
Bash
Executable File
#!/bin/sh
|
|
# This script checks for -h and --help and outputs usage information if the check succeeds.
|
|
# Requires: <program> <package (Devuan)>
|
|
# echo coreutils
|
|
|
|
if [ -z $USAGE_LOCK ] ; then
|
|
export USAGE_LOCK=1
|
|
NAME="$(filename $0)"
|
|
IFS='
|
|
'
|
|
MESSAGE="$(lastarg $@)"
|
|
AGAINST="$(nolastarg $@)"
|
|
IFS=' '
|
|
|
|
if ( [ "$1" = "-h" ] || [ "$1" = "--help" ] ) && [ "$2" = "" ] ; then
|
|
echo "Usage: $NAME [args to check] <usage string> "
|
|
else
|
|
CHECK='-h
|
|
--help'
|
|
if [ "$1" != "" ] ; then
|
|
echo $CHECK | linefirstargdo firstargnthargdo $(( 4 + $# )) firstnthpipedo $(( $# - 1 )) "$AGAINST" invertstatus linematchfirstargdo echo "$MESSAGE"
|
|
CODE="$?"
|
|
exit $CODE
|
|
fi
|
|
fi
|
|
fi
|
|
exit 1
|