我想计算Makefile中graphviz文件中的节点数,以使用它为每个节点启动进程。 我跑的时候
grep -- -\> graph.gv | while read line; do for w in $line; do echo $w; done; done | grep [Aa-Zz] | sort | uniq | wc -l
在shell中,它按预期打印节点数。
但是,当我在Makefile中使用它时
NODES := $(shell grep -- -\> graph.gv | while read line; do for w in $line; do echo $w; done; done | grep [Aa-Zz] | sort | uniq | wc -l)
${NODES}
始终为0.
答案 0 :(得分:3)
你需要逃避$
标志。说:
NODES := $(shell grep -- -\> graph.gv | while read line; do for w in $$line; do echo $$w; done; done | grep [Aa-Zz] | sort | uniq | wc -l)