sfeed_addfeed (385B)
1 #!/bin/sh 2 3 _config=$HOME/.config/sfeed/config 4 _backup=$_config.bkp 5 6 [ -z $1 ] && echo "usage: $(basename $0) <uri>" && exit 2 7 name=$(</dev/null dmenu -p "Feed title:") 8 [ -z "$name" ] && exit 99 9 10 mv $_config $_backup 11 awk -v"uri=$1" -v"title=$name" ' 12 /^feeds\(\)/ { 13 add=1 14 } 15 16 $1 == "feed" && add { 17 add=0 18 printf "\tfeed \"%s\" \"%s\"\n", title, uri 19 } 20 21 { 22 print 23 }' < $_backup > $_config