I have wrote following meta-project file for qmake that is designed to build all .pro
files in the following subdirectories (for historical reasons and because of other toolchains, the file names do not match folder names). Which essentially boils down to something like this (throwing aside project-specific stuff)
THIS_FILE=make-all.pro
TEMPLATE=subdirs
FIND= "find -name \'*.pro\' -printf \'%p\\n\'"
AWK= "awk \'{$1=substr($1,3); print}\'"
RMTHIS= "awk \'!/$$THIS_FILE/\'"
SUBDIRS= $$system($$FIND | $$AWK | $$RMTHIS )
I need to get a list of folders that contain .pro
files within a Bash script, so I decided to copy the method
#!/bin/bash
FIND="find -name '*.pro' -printf '%h\\n"
AWK="awk '{\$1=substr(\$1,3);printf}'"
SUBDIRS=$($FIND | $AWK)
Apparently this doesn't work, awk
was spewing error invalid char ''
in the expression. Trying to execute same lines in Bash directly had shown that awk
actually works only if double quotes are used
find -name '*.pro' | awk "{\$1=substr(\$1,3);printf}"
Replacing the line in question with
AWK='awk "{$1=substr($1,3);printf}" '
gave no working result, the output of script is empty, unlike the output of manually entered command. Apparently
find -name '*.pro'
In script finds only files in current folder, while its counterpart in command line of bash find it in subfolders. What is wrong and why qmake works differently as well?