On Wed, Jun 7, 2023 at 12:53 PM Michael D. Setzer II via users
<users(a)lists.fedoraproject.org> wrote:
rm index.html -f
wget
https://memtest.org/
f=$(grep -m1 binaries.zip <index.html | cut -f2 -d\")
rm index.html -f
[...]
Thanks for any suggestions..
replace above with:
f=$(wget -O -
https://memtest.org/ 2>/dev/null | grep -m1 binaries.zip
| sed -e 's/.*<a href="//' -e 's/".*//')
if [ -z "$f" ]
then
echo "Unable to get pathname for binaries.zip" >&2
exit 1
fi
this way you avoid creating the temporary file and therefore don't
have to worry about deleting. Also checks to make sure you actually
got a pathname. Should also be somewhat more tolerant of changes to
the underlying html.