On Wed, Jun 7, 2023 at 12:53 PM Michael D. Setzer II via users
<users@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.
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to