Introduction
Introduction Statistics Contact Development Disclaimer Help
sfeed_markread: allow to set the url as a parameter or as an env variable - sfe…
git clone git://git.codemadness.org/sfeed_curses
Log
Files
Refs
README
LICENSE
---
commit e2a3071bb2729a3bc87db2322e351bc60fb4d9ff
parent 84529dc8f6cdca8c83c7cb22e1c7d09aa2a0cbf6
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 24 Jul 2021 22:39:57 +0200
sfeed_markread: allow to set the url as a parameter or as an env variable
Diffstat:
M sfeed_markread | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/sfeed_markread b/sfeed_markread
@@ -1,14 +1,22 @@
#!/bin/sh
# Mark items as read/unread: the input is the read / unread URL per line.
-if test -z "$SFEED_URL_FILE"; then
- echo "\$SFEED_URL_FILE must be set" >&2
+usage() {
+ echo "usage: $0 <read|unread> [urlfile]" >&2
exit 1
+}
+
+urlfile="${2:-${SFEED_URL_FILE}}"
+if test -z "${urlfile}"; then
+ echo "An urlfile must be set as a parameter or with the environment va…
+ echo "" >&2
+ usage
fi
case "$1" in
read)
- cat >> "$SFEED_URL_FILE";;
+ cat >> "${urlfile}"
+ ;;
unread)
tmp=$(mktemp)
trap "rm -f ${tmp}" EXIT
@@ -22,7 +30,6 @@ unread)
cp "${tmp}" "${urlfile}"
;;
*)
- echo "$0 <read|unread>" >&2
- exit 1
+ usage
;;
esac
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.