From f11a83207e85e9007cf908a50318d50ef1e7bab9 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Thu, 6 Apr 2023 20:22:00 +0200 Subject: README: improve error checking for temporary files in examples Similar to the recent fix for sfeed_update in commit 5a27c58675ddf4113d64a84f715cb3fecb681a6d --- README | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 6611793..3cb650d 100644 --- a/README +++ b/README @@ -742,9 +742,9 @@ sfeed_update_xargs shellscript: } # fetch feeds and store in temporary directory. - sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')" + sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')" || exit 1 mkdir -p "${sfeedtmpdir}/feeds" - touch "${sfeedtmpdir}/ok" + touch "${sfeedtmpdir}/ok" || exit 1 # make sure path exists. mkdir -p "${sfeedpath}" # print feeds for parallel processing with xargs. @@ -841,7 +841,7 @@ arguments are specified then the data is read from stdin. # ...else parent mode: - tmp=$(mktemp) + tmp="$(mktemp)" || exit 1 trap "rm -f ${tmp}" EXIT [ -f "${cachefile}" ] || touch "${cachefile}" @@ -1188,7 +1188,7 @@ Example of a `markallread.sh` shellscript to mark all URLs as read: #!/bin/sh # mark all items/URLs as read. - tmp=$(mktemp) + tmp="$(mktemp)" || exit 1 (cat ~/.sfeed/urls; cut -f 3 ~/.sfeed/feeds/*) | \ awk '!x[$0]++' > "$tmp" && mv "$tmp" ~/.sfeed/urls && -- cgit v1.2.3