Search This Blog


Monday, August 29, 2011

HowTo: Have Doxygen support Bash/Awk/Sed Script files. - text.doxygen.general - Re: Having Doxygen support script languages - msg#00027

Doxygen doesn't support bash script files. While that probably makes sense, to not support them (define a bash script file in terms of functions and variables), there are always a few laying around in a source tree that should go into the document.

It's easiest to add the script files without changing them, so a doxygen input filter. Input filters work pretty good with command line sed or awk commands, so we'll do a simple one here that lets you add Doxygen commands comeent lines starting with ##.

Edit these lines in your Doxyfile:
FILE_PATTERNS = *.sh *.awk
INPUT_FILTER = "sed -e 's|##|//!|'"

Add a brief description to the top of each file:
## functions for OpenEmbedded, and Jenkins -*- shell-script -*-.
## @author rickfoosusa
## @file

Generally anything with # for a comment will work, but for languages you get a lot more documentation by using a filter like


  1. Thanks a lot dude! Just enough to get there!

  2. Hey,
    first thanks a lot, the following little adds completeness of code-display:
    INPUT_FILTER = "sed -e 's|##\(.*\)$|##\1 //!\1|'"

    Arno-Can Uestuensoez

  3. I am having trouble with Doxygen parsing a bash script. I have a few assigns at the top, like x=1 then y=1 ... it can't parse out y as a separate variable. Is there something I am missing in my config? or is there some doxygen comment to add?

  4. That's a great lead to adapt any kind of files being documented using Doxygen. I've been using your code to create an answer at StackOverflow regarding documentation of makefile templates/snippets: