Presumably you meant to send all the output of the various statements to dot
, like this:
{
echo "digraph CG{"
cat "$tmp"
echo "}"
} | dot -T png > callgraph.png
Question
I've got this code I can't seem to get running:
echo "digraph G{"; cat "$file"; echo "}" | dot -T png > graph.png
The terminal echoes all it should but gets stuck on the } symbol. I guess there's something wrong syntactically.
Warning: <stdin>: syntax error in line 1 near '}'
Could you please be of quick help?
Solution
Presumably you meant to send all the output of the various statements to dot
, like this:
{
echo "digraph CG{"
cat "$tmp"
echo "}"
} | dot -T png > callgraph.png
OTHER TIPS
With bash, you can collapse the echo;cat;echo
echo "digraph CG{$(< "$tmp")}" | dot ...
Or, if you like the extra newlines
printf 'digraph CG{\n%s\n}\n' "$(< "$tmp")" | dot ...