Design shell script interfaces with clear options, operands, usage text, stdout/stderr behavior, and exit statuses.
The move: design the command before you write the body. Options, operands, and -- POSIX gives shell authors a shared vocabulary. Options are switches such as -n or -c customer. Operands are the main things the command acts on, such as files or dates. -- marks the end of options, which matters when an operand begins with -. Use this shape and your script becomes easier to predict. Streams are part of the API Send machine-readable output to stdout. Send prompts, progress, warnings, and errors to stderr. A caller can then redirect or pipe the useful result without scraping progress…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in