#!/bin/sh # load config (evaluate shellscript). # loadconfig(configfile) loadconfig() { # allow to specify config via argv[1]. if [ "$1" != "" ]; then # get absolute path of config file required for including. config="$1" path=$(readlink -f "${config}" 2>/dev/null) else # default config location. config="$HOME/.sfeed/sfeedrc" path="${config}" fi # config is loaded here to be able to override $sfeedpath or functions. if [ -r "${path}" ]; then . "${path}" else echo "Configuration file \"${config}\" cannot be read." >&2 echo "See sfeedrc.example for an example." >&2 exit 1 fi } # override feed function to output OPML XML. # feed(name, feedurl, [basesiteurl], [encoding]) feed() { # TABs, newlines and echo options in field values are not checked. echo "$1 $2" } # load config file. loadconfig "$1" cat < OPML export from sfeed ! feeds | awk -F '\t' '{ gsub("&", "\\&"); gsub("\"", "\\""); gsub("'"'"'", "\\'"); gsub("<", "\\<"); gsub(">", "\\>"); print "\t"; }' cat < !