about summary refs log tree commit diff stats
path: root/sfeed_update_urls.sh
blob: d4eaebf92fdddd0955f03ac829107eeeab11e11f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

. "$1"

feed() { # feed NAME URL BASE_URL ENCODING
	printf '%s\t%s\t%s\n' "$1" "$2" "${3:-}"
}

DIR="${SFEED_DATA:-$HOME/.sfeed}/urls"
mkdir -p "$DIR"

feeds | awk -v dir="$DIR" '
BEGIN{FS="\t";}
{
      gsub(/\//, "_", $1);
      file = dir "/" $1;
      if ($2) print $2 > file;
      if ($3) print $3 >> file;
}'