Move 'usage' info to a function

Improves eficiency avoiding to load the usage text in memory three times.
This commit is contained in:
Jorge Juan 2015-08-03 01:30:45 +02:00
parent bc22934da5
commit 56aa1dc076

11
mscs
View File

@ -48,7 +48,8 @@
# Script Usage
# ---------------------------------------------------------------------------
USAGE=$(cat <<EOF
usage() {
cat <<EOF
Usage: $0 <option>
Options:
@ -136,9 +137,9 @@ Options:
update <world>
Update the server software for the Minecraft world server. Update
server software for all worlds by default.
EOF
)
}
# Override Global Variables
# ---------------------------------------------------------------------------
@ -2346,12 +2347,12 @@ case "$1" in
usage|help)
printf "Minecraft Server Control Script\n"
printf "\n"
printf "$USAGE\n"
usage
;;
*)
printf "Error in command line usage.\n"
printf "\n"
printf "$USAGE\n"
usage
exit 1
;;
esac