Date: Thu, 5 Dec 2019 07:35:31 +0100 From: Polytropon <freebsd@edvax.de> To: freebsd-questions@freebsd.org Subject: Re: Counter in sh inside loop, value "encapsulation" Message-ID: <20191205073531.cb2a23ac.freebsd@edvax.de> In-Reply-To: <20191205051145.78f9a805.freebsd@edvax.de> References: <20191204181300.8dd0e03c.freebsd@edvax.de> <slrnqug5mi.srf.naddy@lorvorc.mips.inka.de> <20191205051145.78f9a805.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191205073531.cb2a23ac.freebsd>
