From a5433ddcfbc533debf34085181a840dd7d15f89b Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Mon, 21 May 2018 18:23:09 -0700 Subject: [PATCH] shellcheck --- tools/api_reference/add_google_analytics.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/api_reference/add_google_analytics.sh b/tools/api_reference/add_google_analytics.sh index ecff7196048..14549b79c9a 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 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__${S}_" "$M" fi -done; +done < <(find . -name \*.html -print0)