Search code examples
linuxenvironment-variablesgraphviz

Graphviz: use environment variables in hyperlinks


The following dot file contains a hyperlink pointing to a local text file.

digraph d {
    A [href="/home/test/test.txt"]
    A -> B
    A -> C
}

Suppose an environment variable, HOME_TEST, has the value "/home/test". Is it possible to use the environment variable in the dot file instead of the hard coding?


Solution

  • Short answer:

    No. dot has no mechanism to do that.

    Longer (very generic) answer:

    You can use something like make in conjunction with m4 or another macro-processor to do what you want/need.