diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2024-08-09 14:11:50 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2024-08-09 14:11:50 -0400 |
commit | 5857d82e8e596d6fda406a0c4d8d68ca7a03c124 (patch) | |
tree | 553916894dee907825360580c5d9a05c82c5af16 /sfeed_markread | |
parent | 3574e3cbf9d99546e868aeb995ce2c171cdc36a6 (diff) | |
parent | 19957bc272e745af7b56b79fa648e8b6b77113b1 (diff) |
Diffstat (limited to 'sfeed_markread')
-rwxr-xr-x | sfeed_markread | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sfeed_markread b/sfeed_markread index a40e572..cad71bc 100755 --- a/sfeed_markread +++ b/sfeed_markread @@ -2,14 +2,14 @@ # Mark items as read/unread: the input is the read / unread URL per line. usage() { - echo "usage: $0 <read|unread> [urlfile]" >&2 + printf "usage: %s <read|unread> [urlfile]\n" "$0" >&2 echo "" >&2 echo "An urlfile must be specified as an argument or with the environment variable \$SFEED_URL_FILE" >&2 exit 1 } urlfile="${2:-${SFEED_URL_FILE}}" -if test -z "${urlfile}"; then +if [ -z "${urlfile}" ]; then usage fi @@ -18,9 +18,9 @@ read) cat >> "${urlfile}" ;; unread) - tmp=$(mktemp) + tmp="$(mktemp)" || exit 1 trap "rm -f ${tmp}" EXIT - test -f "${urlfile}" || touch "${urlfile}" 2>/dev/null + [ -f "${urlfile}" ] || touch "${urlfile}" 2>/dev/null LC_ALL=C awk -F '\t' ' { FILENR += (FNR == 1) } FILENR == 1 { urls[$0] = 1 } |