commit f11a83207e85e9007cf908a50318d50ef1e7bab9
parent 15d18283616a951f060daf8f96996def532b8e21
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Thu, 6 Apr 2023 20:22:00 +0200
README: improve error checking for temporary files in examples
Similar to the recent fix for sfeed_update in commit
5a27c58675ddf4113d64a84f715cb3fecb681a6d
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git 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 &&