我有以下graphviz
脚本,我希望将其转换为 bash 脚本。
#!/bin/bash
graph=$(cat <<GRAPHEND
graph match {
node[style=filled shape=point label= ""];
size="40.0,40.0";
fontsize=10.0;
overlap=false ;
spline=true;
nodesep=4.0;
"aaa" -- "aab" [penwidth=2.25 color="red" label="4" fontsize=7.0];
} GRAPHEND
)
echo $graph
#neato -Tpng $graph > graph.png
此试验失败并出现以下错误
./high_match.dot: line 2: unexpected EOF while looking for matching `)'
./high_match.dot: line 11: syntax error: unexpected end of file
PS:第二行中的行号可能不准确,因为我已在此处编辑了文件。
答案1
应该GRAPHEND
在一个新线上。
#!/bin/bash
graph=$(cat <<GRAPHEND
graph match {
node[style=filled shape=point label= ""];
size="40.0,40.0";
fontsize=10.0;
overlap=false ;
spline=true;
nodesep=4.0;
"aaa" -- "aab" [penwidth=2.25 color="red" label="4" fontsize=7.0];
}
GRAPHEND
)
echo $graph