I am learning bash. Nothing special, just tinkering around with my own scripts. It's great fun.

Looking at options to document your bash scripts, I came across this.

What is the significance of the double "##", and the tags "@var", "@brief" etc.

I am guessing I am missing a trick here.

## @var DEBUG
## @brief Enables / disables the debug mode.
## @details The debug mode adds extra information for troubleshooting purposes.
## Value: yes or no (y / n).
  • To be clear, comments don't mean anything to Bash itself. Special comments like this are processed by a different program (Doxygen, in this case). A shebang is also a special comment, but that's processed by the kernel. – wjandrea Dec 14 '18 at 20:23

They are Doxygen documentation commands. Doxygen can generate HTML and other format documentation. Those commands control how the documentation is formatted, eg. bolding text.

| improve this answer | |
  • 5
    Yes. For the shell (bash, for example) they are just ordinary comments but Doxygen recognizes the keywords @var, @brief, @details within comments and can generate documentation from them. – PerlDuck Sep 14 '18 at 15:46
  • I will take a look at Doxygen. I know there are also other tools that create documentation also. As a final quick question, is there a recommended tool to use, do most people use Doxygen ? – hatterman Sep 16 '18 at 15:01
  • @hatterman I think most projects use Doxygen. Sphinx is also quite popular. I can't compare them, though, I've only used Doxygen. – SurvivalMachine Sep 16 '18 at 16:54
  • Thanks. Ive staeted reading the docs, I will give it a whirl. – hatterman Sep 17 '18 at 8:32

Anything starting with a hash sign (#) is a comment. It is like a REM in Windows batch or command file. So, all of the lines that you show are comments.

If I had to guess, this was copied and pasted from a Windows batch file. The @ in a Windows batch file means "do not echo out this line". The @ in a Bash shell in this particular situation means nothing.

| improve this answer | |
  • No, its from a Linux bash script. I know the # is a comment. – hatterman Sep 16 '18 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.