My makefile has some code as follows:
if [ `../${TOOLS_ROOT_PATH}/ext_tools.sh 1` ]; then \
echo copying tools; \
cp -f `../${TOOLS_ROOT_PATH}/ext_tools.sh 1` ${EXTERNAL_BIN_DIR} || exit $$?;\
fi; \
The ext_tools.sh is as follows:
cat ttx.conf | grep external | grep -v ^# | awk '{print $1}'
It can sometime result in nothing as existing tools in ttx.conf may not contain external tag to them. And sometimes, it might return a string of words separated by space.
With the above piece of code, if ext_tools.sh return string of words, /bin/sh is expecting argument -f or -z.
But if I put it there, when ext_tools.sh return nothing, /bin/sh is complaining again.
My question is how do I check its return value? More specifically, how do I check if it returned NULL? How do I separate words in the string?
I tried the following:
RESULT=`../${TOOLS_ROOT_PATH}/ext_tools.sh 1`; \
echo "$RESULT"; \
But echo prints ESULT.
When I do echo $(RESULT), echo doesnot print anything
When I do echo ${RESULT}, echo doesnot print anything.
I tried
set `../${TOOLS_ROOT_PATH}/ext_tools.sh 1`; \
echo $#; \
Again, echo doesnot print anything.
Please help.. I am out of ideas...