I'm trying to merge the output of 2 find
commands and pipe it to the next operator. The arguments passed to both find
executions are very similar so I'd like to keep it DRY
FIND_CMD_ARGS="-type f \( -iname \*.m -o -iname \*.swift \) -print0"
CMD_OUTPUT=`{ find $PROJECT_PATH -not -path '*/Pods/*' $FIND_CMD_ARGS; find . -path '*/Pods/MyProject*/*' $FIND_CMD_ARGS }`
For some reason this doesn't work and this is the output I get
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
find: -type f \( -iname \*.m -o -iname \*.swift \) -print0: unknown primary or operator
I think the issue is related to how the args
in the FIND_CMD_ARGS
environment variable are escaped but I can't figure out the right way to do it.
Any ideas? Thanks!