I'd like to assign a variable in a Tupfile the output of the command find . -name "*.cpp" -exec dirname {} \; | sort -u. How can I do it?
How to assign a variable the output of a shell command in Tupfile?
231 Views Asked by e271p314 At
2
There are 2 best solutions below
0
On
From what I read in the manual, the variable assignment does not cause the shell command to be executed. Instead, it is stored as regular string. Then when the variable is passed to a command, the shell expands it. It means that if you have K files to compile, the shell expression will be evaluated K times.
This works for me:
NOTE: the back-tick character "`"
However this only seems to work in the command section of the rules not the dependencies.