Usage Message
noun
say it: “YOO-sij MES-ij” /ˈjusɪdʒ ˈmɛsɪdʒ/
A short line a script or command prints to show how to run it, with the parts to fill in written in capitals.
What is a usage message?
A usage message shows how to run a script, with the parts to fill in written in capitals. When someone runs the script the wrong way, it goes to standard error with exit code 2; when they ask with --help, it goes to standard output with exit code 0.
usage="Usage: mover.sh FROM-FOLDER TO-FOLDER"
if [[ $# -ne 2 ]]; then
echo "$usage" >&2
exit 2
fi
# ./mover.sh prints Usage: mover.sh FROM-FOLDER TO-FOLDER
In a sentence
- “Asked with --help, the script prints the same usage message on standard output.”
- “Run with no folders, mover.sh printed its usage message and stopped with exit code 2.”
Level: Apprentice · More Unix terms at this level
Updated