diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2023-04-06 20:22:00 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2023-04-06 20:22:00 +0200 |
commit | f11a83207e85e9007cf908a50318d50ef1e7bab9 (patch) | |
tree | e30c756ddcb9667b73eea7050f50bb703b2d817d | |
parent | 15d18283616a951f060daf8f96996def532b8e21 (diff) |
README: improve error checking for temporary files in examples
Similar to the recent fix for sfeed_update in commit
5a27c58675ddf4113d64a84f715cb3fecb681a6d
-rw-r--r-- | README | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 && |