Providing help output

Consider providing a little help to users of your script if they try running it with a -h or --help option; even a single line showing which arguments are expected and in what order can be very helpful:

case $1 in
    -h|--help)
        printf 'USAGE: myscript [--verbose] FILE1 [FILE2...] TARGETDIR\n'
        ;;
esac

The manual page describing manual pages on GNU/Linux systems, viewable with man man-pages, gives some information on common expected formats for these usage strings.

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.