diff options
author | June McEnroe <june@causal.agency> | 2018-09-20 12:19:36 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-09-20 12:19:36 -0400 |
commit | 97df7c4c38392739edec4309d31c42947597edfa (patch) | |
tree | 26c14ad6b8dd301f4ea2cb3baad0b4699f4641e4 | |
parent | Correct typo in Using Make (diff) | |
download | src-97df7c4c38392739edec4309d31c42947597edfa.tar.gz src-97df7c4c38392739edec4309d31c42947597edfa.zip |
Use here documents in feed.sh
Diffstat (limited to '')
-rwxr-xr-x | feed.sh | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/feed.sh b/feed.sh index 4a45ce45..3c6e6589 100755 --- a/feed.sh +++ b/feed.sh @@ -2,24 +2,28 @@ set -e -u updated=$(date -u '+%FT%TZ') -echo '<?xml version="1.0" encoding="utf-8"?>' -echo '<feed xmlns="http://www.w3.org/2005/Atom">' -echo '<title>Causal Agency</title>' -echo '<author><name>June</name><email>june@causal.agency</email></author>' -echo '<link href="https://text.causal.agency"/>' -echo '<id>https://text.causal.agency/</id>' -echo "<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') - echo '<entry>' - echo "<title>${title}</title>" - echo "<summary>${summary}</summary>" - echo "<link href=\"https://text.causal.agency/${entry%.7}.txt\"/>" - echo "<id>${url}</id>" - echo "<updated>${updated}</updated>" - echo '</entry>' + cat <<EOF + <entry> + <title>${title}</title> + <summary>${summary}</summary> + <link href="${url}"/> + <id>${url}</id> + <updated>${updated}</updated> + </entry> +EOF done echo '</feed>' |