dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

addfeed (335B)


      1 #!/bin/sh
      2 set -e
      3 sfeedrc="$HOME/.sfeed/sfeedrc"
      4 
      5 if [ $# -ne 2 ]; then
      6 	printf 'usage: %s feedname url\n' "${0##*/}" >&2
      7 	exit 1
      8 fi
      9 
     10 # use temp file because no write permission in sfeedrc dir
     11 temp="$(mktemp)"
     12 new="$(printf "	feed '%s' '%s'\n" "$1" "$2")"
     13 sed "/}/i \\
     14 $new
     15 " "$sfeedrc" > "$temp"
     16 cat "$temp" > "$sfeedrc"
     17 rm -f "$temp"