As with any programming language, it's good to be able to add comments or documentation to your code. This is a 'best practice'.
In bash, (as in Perl) a comment can be added by starting a line with the octothorpe: #.
You may come back to a script a year later, and wonder why you did something a particular way, or what does that variable actually refer to?
# this is a 1-line comment, which will NOT be executed # neither will the next line # exit
I usually start my scripts with something like this:
#!/usr/local/bin/bash # whatis.sh # 2024-12-04 # determine type of file
Commenting like this has the advantage of being easy to see in the midst of 147 lines of bash code.
Here is another way to add multi-line comments:
<<"Comment" This is a multi-line comment Comment
A here document saves a lot of typing.
Quoting the COMMENT delimiter above is necessary to prevent parameter expansion, command substitution and arithmetic expansion, which would happen otherwise.
<<"Lorem" Montes $inceptos per in placerat curae torquent efficitur auctor. echo "You can't see me" exit Dignissim, aenean vitae elementum nisi finibus nibh eros cras mattis, primis a fringilla erat maximus eu accumsan vel ullamcorper, nunc netus litora turpis pretium hendrerit tempor malesuada. LoremLorem