summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koch <markus@notsyncing.net>2020-04-26 17:22:44 +0200
committerMarkus Koch <markus@notsyncing.net>2020-04-26 17:22:44 +0200
commit98cd0c8fe9fb1c3409fcac79af3f760b90a7dcd2 (patch)
tree195881e8ba2bcdba750860f26ceef94712228e60
parent2f02ca1d2a0d489ec65619a8d64c3deb76af2694 (diff)
downloadlifomapserver-98cd0c8fe9fb1c3409fcac79af3f760b90a7dcd2.tar.gz
lifomapserver-98cd0c8fe9fb1c3409fcac79af3f760b90a7dcd2.tar.bz2
lifomapserver-98cd0c8fe9fb1c3409fcac79af3f760b90a7dcd2.zip
Properly quote in fetch scripts
-rwxr-xr-xscripts/geojson/fetch_city_outlines.sh8
-rwxr-xr-xscripts/geojson/fetch_streets.sh6
2 files changed, 7 insertions, 7 deletions
diff --git a/scripts/geojson/fetch_city_outlines.sh b/scripts/geojson/fetch_city_outlines.sh
index 3f65b22..c9c2b58 100755
--- a/scripts/geojson/fetch_city_outlines.sh
+++ b/scripts/geojson/fetch_city_outlines.sh
@@ -1,14 +1,14 @@
#!/bin/bash
json=`curl 'https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Cities'`
-data=`echo $json | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
+data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
echo "["
export IFS="}"
for entry in $data; do
- name=`echo $entry | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
- type=`echo $entry | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
- coord=`echo $entry | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
+ name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
+ type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
+ coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
if [[ "$name" != "" && "$coord" != "" ]]; then
echo "{ \"type\": \"Feature\",
\"geometry\": {
diff --git a/scripts/geojson/fetch_streets.sh b/scripts/geojson/fetch_streets.sh
index dbae43d..741f82a 100755
--- a/scripts/geojson/fetch_streets.sh
+++ b/scripts/geojson/fetch_streets.sh
@@ -3,13 +3,13 @@
# WARNING: This script is not yet production ready. The slightest error in the wikipage can throw it off. Handle with care.
json=`curl 'https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Streets'`
-data=`echo $json | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
+data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
echo "["
export IFS="}"
for entry in $data; do
- name=`echo $entry | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
- coord=`echo $entry | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
+ name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
+ coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
if [[ "$name" != "" && "$coord" != "" ]]; then
echo "{ \"type\": \"Feature\",
\"geometry\": {