bash help
bash linux
Bash scripting
1. Help option in bash script
#!/bin/bash
USAGE="my-script — does one thing well
Usage:
my-script <input> <output>
Options:
<input> Input file to read.
<output> Output file to write. Use '-' for stdout.
-h Show this message.
"
help() {
echo "$USAGE"
}
#if [[ $# = 0 ]] || [[ "$1" = "-h" ]]; then
if [[ "$1" = "-h" ]]; then
help
exit 1
fi