aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/api_reference
diff options
context:
space:
mode:
authorGravatar Carl Mastrangelo <notcarl@google.com>2018-05-21 18:23:09 -0700
committerGravatar Carl Mastrangelo <notcarl@google.com>2018-05-21 18:23:09 -0700
commita5433ddcfbc533debf34085181a840dd7d15f89b (patch)
tree6324b6628435a6ebad921b7db57627e226d6c2b5 /tools/api_reference
parenta613f2f53763f469335209c16e54551f7a20d92f (diff)
shellcheck
Diffstat (limited to 'tools/api_reference')
-rwxr-xr-xtools/api_reference/add_google_analytics.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/api_reference/add_google_analytics.sh b/tools/api_reference/add_google_analytics.sh
index ecff719604..14549b79c9 100755
--- a/tools/api_reference/add_google_analytics.sh
+++ b/tools/api_reference/add_google_analytics.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2018 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,12 +28,13 @@ read -r -d '' SNIPPET << EOF
</script>
EOF
-S="$(echo -n $SNIPPET | tr '\n' ' ')"
+S=$(echo -n "$SNIPPET" | tr '\n' ' ')
-for M in $(find -name \*.html);
+while IFS= read -r -d '' M
do
- grep -q "i,s,o,g,r,a,m" "$M"
- if [[ $? -ne 0 ]]; then
+ if grep -q "i,s,o,g,r,a,m" "$M"; then
+ :
+ else
sed -i "s_</head>_${S}</head>_" "$M"
fi
-done;
+done < <(find . -name \*.html -print0)