LDP/LDP/guide/docbook/abs-guide/usage-message.sh

17 lines
530 B
Bash
Raw Permalink Normal View History

2002-07-22 15:12:57 +00:00
#!/bin/bash
# usage-message.sh
: ${1?"Usage: $0 ARGUMENT"}
# Script exits here if command-line parameter absent,
#+ with following error message.
# usage-message.sh: 1: Usage: usage-message.sh ARGUMENT
echo "These two lines echo only if command-line parameter given."
2008-11-23 22:43:47 +00:00
echo "command-line parameter = \"$1\""
2002-07-22 15:12:57 +00:00
exit 0 # Will exit here only if command-line parameter present.
# Check the exit status, both with and without command-line parameter.
# If command-line parameter present, then "$?" is 0.
# If not, then "$?" is 1.