Just as with any kind of programming, it's important to write some documentation to help your users understand and run your program, and to know all of its available features. We'll look at three documentation methods: writing comments, providing help output, and writing manual pages.
Documenting scripts
Writing comments
It's good practice to add comments to any code to explain what it's doing to the curious (or debugging) reader, and Bash is no exception. Keep your comments concise, up-to-date, and most of all, useful. Remember: don't just rephrase what the code is doing; explain why you're doing it, not just what it does.
Consider this comment and line of shell script:
# Loop to end of positional...