Browse Source

Use here documents in feed.sh

June 2 months ago
parent
commit
97df7c4c38
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 18 additions and 14 deletions
  1. 18
    14
      feed.sh

+ 18
- 14
feed.sh View File

@@ -2,24 +2,28 @@
2 2
 set -e -u
3 3
 
4 4
 updated=$(date -u '+%FT%TZ')
5
-echo '<?xml version="1.0" encoding="utf-8"?>'
6
-echo '<feed xmlns="http://www.w3.org/2005/Atom">'
7
-echo '<title>Causal Agency</title>'
8
-echo '<author><name>June</name><email>june@causal.agency</email></author>'
9
-echo '<link href="https://text.causal.agency"/>'
10
-echo '<id>https://text.causal.agency/</id>'
11
-echo "<updated>${updated}</updated>"
5
+cat <<EOF
6
+<?xml version="1.0" encoding="utf-8"?>
7
+<feed xmlns="http://www.w3.org/2005/Atom">
8
+<title>Causal Agency</title>
9
+<author><name>June</name><email>june@causal.agency</email></author>
10
+<link href="https://text.causal.agency"/>
11
+<id>https://text.causal.agency/</id>
12
+<updated>${updated}</updated>
13
+EOF
12 14
 for entry in *.7; do
13 15
 	url="https://text.causal.agency/${entry%.7}.txt"
14 16
 	title=$(grep '^\.Nm' "$entry" | cut -c 5-)
15 17
 	summary=$(grep '^\.Nd' "$entry" | cut -c 5-)
16 18
 	updated=$(date -j -u -f '%s' "$(stat -f '%m' "$entry")" '+%FT%TZ')
17
-	echo '<entry>'
18
-	echo "<title>${title}</title>"
19
-	echo "<summary>${summary}</summary>"
20
-	echo "<link href=\"https://text.causal.agency/${entry%.7}.txt\"/>"
21
-	echo "<id>${url}</id>"
22
-	echo "<updated>${updated}</updated>"
23
-	echo '</entry>'
19
+	cat <<EOF
20
+	<entry>
21
+	<title>${title}</title>
22
+	<summary>${summary}</summary>
23
+	<link href="${url}"/>
24
+	<id>${url}</id>
25
+	<updated>${updated}</updated>
26
+	</entry>
27
+EOF
24 28
 done
25 29
 echo '</feed>'

Loading…
Cancel
Save