3 ms·
One of my favorite techniques for shell scripts, not mentioned in the article: For rarely run scripts, consider checking if required flags are missing and quer
by archargelod 2y ago
One of my favorite techniques for shell scripts, not mentioned in the article:
For rarely run scripts, consider checking if required flags are missing and query for user input, for example:
[[ -z "$filename" ]] && printf "Enter filename to edit: " && read filename
Power users already know to always do `-h / --help` first, but this way even people that are less familiar with command line can use your tool.
if that's a script that's run very rarely or once, entering the fields sequentially could also save time, compared to common `try to remember flags -> error -> check help -> success` flow.