This code snippet is functional for a given list of dirs in 'dirlist.txt'
DIR_LIST = "dirlist.txt"
exclude_legacy:
@echo "=== Checking dirs to exclude..."
while read -r dirto_exclude; \
do \
if [[ "$${dirto_exclude}" = \#.* ]]; then \
continue; \
else \
echo "Exclude this dir, $${dirto_exclude}"; \
rm -rf $${dirto_exclude}; \
fi \
done < $(DIR_LIST)
Have two questions:
Interested to know if there are better ways to achieve the same with the help of make's built-in functions.
Running 'make -s -f Makefile' purges the desired dirs given in 'dirlist.txt'.However, the output from the echo statement (in the else block) prints lines with comments as well that were skipped in the condition given in the 'if' block. I expected the output to contain only those dirnames that are to be purged, which is shown as expected.
Why is this?
Thanks, Viji