adapt wordpress helper script to json format, fix shellcheck issues
Hanno Böck

Hanno Böck commited on 2020-02-17 17:33:46
Zeige 1 geänderte Dateien mit 9 Einfügungen und 9 Löschungen.

... ...
@@ -1,4 +1,4 @@
1
-#!/bin/sh
1
+#!/bin/bash
2 2
 #
3 3
 # helper script for development only, creates version list
4 4
 # of all supported wordpress versions + one future version
... ...
@@ -8,19 +8,19 @@ vers=$(curl -s https://api.wordpress.org/core/version-check/1.7/ | jq . | grep c
8 8
 
9 9
 safe=$(echo "$vers"|head -n 1)
10 10
 
11
-echo safe=$safe
11
+echo '    "safe": "'"$safe"'",'
12 12
 
13
-echo -n old_safe=
13
+echo -n '    "old_safe": "'
14 14
 for ver in $(echo "$vers"|tail -n +2); do
15 15
 
16
-	pre=$(echo $ver | sed -e 's:[0-9]*$::g')
17
-	post=$(echo $ver | sed -e 's:.*\.::g')
16
+	pre=$(echo "$ver" | sed -e 's:[0-9]*$::g')
17
+	post=$(echo "$ver" | sed -e 's:.*\.::g')
18 18
 
19
-	let postadd=post+1
19
+	((postadd=post+1))
20 20
 
21
-	echo -n $pre$postadd,
22
-	echo -n $pre$post,
21
+	echo -n "$pre$postadd",
22
+	echo -n "$pre$post",
23 23
 
24 24
 done | sed -e 's:,$::g'
25 25
 
26
-echo
26
+echo '",'
27 27