diff options
author | June McEnroe <june@causal.agency> | 2019-07-27 17:00:47 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-07-27 17:00:47 -0400 |
commit | a90eeec85067b6d0a19c9be69530eebed886da86 (patch) | |
tree | 154de9e0c023c5294fb8d79bf755d5715e55ce5a /www/text.causal.agency/feed.sh | |
parent | Add c11.pdf (diff) | |
download | src-a90eeec85067b6d0a19c9be69530eebed886da86.tar.gz src-a90eeec85067b6d0a19c9be69530eebed886da86.zip |
Shell script style pass
Diffstat (limited to 'www/text.causal.agency/feed.sh')
-rw-r--r--[-rwxr-xr-x] | www/text.causal.agency/feed.sh | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/www/text.causal.agency/feed.sh b/www/text.causal.agency/feed.sh index 3c6e6589..21b1d4a3 100755..100644 --- a/www/text.causal.agency/feed.sh +++ b/www/text.causal.agency/feed.sh @@ -1,29 +1,30 @@ #!/bin/sh -set -e -u +set -eu updated=$(date -u '+%FT%TZ') -cat <<EOF -<?xml version="1.0" encoding="utf-8"?> -<feed xmlns="http://www.w3.org/2005/Atom"> -<title>Causal Agency</title> -<author><name>June</name><email>june@causal.agency</email></author> -<link href="https://text.causal.agency"/> -<id>https://text.causal.agency/</id> -<updated>${updated}</updated> +cat <<- EOF + <?xml version="1.0" encoding="utf-8"?> + <feed xmlns="http://www.w3.org/2005/Atom"> + <title>Causal Agency</title> + <author><name>June</name><email>june@causal.agency</email></author> + <link href="https://text.causal.agency"/> + <id>https://text.causal.agency/</id> + <updated>${updated}</updated> EOF for entry in *.7; do url="https://text.causal.agency/${entry%.7}.txt" title=$(grep '^\.Nm' "$entry" | cut -c 5-) summary=$(grep '^\.Nd' "$entry" | cut -c 5-) - updated=$(date -j -u -f '%s' "$(stat -f '%m' "$entry")" '+%FT%TZ') - cat <<EOF - <entry> - <title>${title}</title> - <summary>${summary}</summary> - <link href="${url}"/> - <id>${url}</id> - <updated>${updated}</updated> - </entry> -EOF + mtime=$(stat -f '%m' "$entry") + updated=$(date -ju -f '%s' "$mtime" '+%FT%TZ') + cat <<- EOF + <entry> + <title>${title}</title> + <summary>${summary}</summary> + <link href="${url}"/> + <id>${url}</id> + <updated>${updated}</updated> + </entry> + EOF done echo '</feed>' |