Counter in sh inside loop, value "encapsulation"
Polytropon
freebsd at edvax.de
Thu Dec 5 06:35:41 UTC 2019
For further reference, the simple solution is always the best one.
I now have the following:
COUNT=0
for URL in `grep "^https" ${INFILE}`; do
process ${URL}
if [ $? -eq 0 ]; then
COUNT=`expr ${COUNT} + 1`
fi
done
echo "URLs processed: ${COUNT}"
There now is no piping step (and therefore no subshell) involved.
This works and can be easily extended (more preprocessing from
the input list file).
I have no idea why I didn't think of this in the first place... :-)
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list