diff options
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 } |