Updated the useage function to use printf

Using a hear doc means we have to exactly specify the formatting. Useing
printf handles formatting for us
This commit is contained in:
James Conroy
2021-12-07 21:34:19 -06:00
parent 1fee5e6a60
commit 81122d0693

View File

@@ -15,21 +15,26 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
MYNAME="${0##*/}"
if ! [ "$(id -u)" = 0 ]; then
echo "This command must be run as root"
echo "${MYNAME}: This command must be run as root"
exit 1
fi
display_help() {
cat <<HELP_USAGE
$0 [-h] [-q|--quiet]
-h Show this message.
-q|--quiet Suppress the output and only return a
single status code for overall status
0:Ok, 1:Error, 2:Starting/Pending, 99:Installing SO
HELP_USAGE
printf "%s" "${MYNAME}"
printf " [%s]" "-h" "-q|--quiet"
printf "\n"
printf "\t-%s\t%s\n" \
"h" "Show this message." \
"q,--quiet" "suppress the output and return a single status code of overall status"
printf "\nReturn Codes:\n"
printf "\t%s:%s\n" \
"0" "Ok" \
"1" "Error" \
"2" "Starting/Pending"\
"99" "Installing SO"
}
# Constants