From 1e34d9df7d8676029bd4fa3cbbf33a363f44aa84 Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Mon, 18 Feb 2019 17:21:55 +0200 Subject: [PATCH] hack/lib/util.sh: replace sed with bash replace. Test script: #!/bin/bash rev1="foo" rev2="\"bar\"" rev3="'bar'" newrev1="${rev1//[\'\"]}" newrev2="${rev2//[\'\"]}" newrev3="${rev3//[\'\"]}" oldrev1=$(echo "${rev1}" | sed "s/['\"]//g") oldrev2=$(echo "${rev2}" | sed "s/['\"]//g") oldrev3=$(echo "${rev3}" | sed "s/['\"]//g") echo "$newrev1 vs. $oldrev1" echo "$newrev2 vs. $oldrev2" echo "$newrev3 vs. $oldrev3" expected output: foo vs. foo bar vs. bar bar vs. bar --- hack/lib/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/lib/util.sh b/hack/lib/util.sh index 2402b8d5991..c820206d8ee 100755 --- a/hack/lib/util.sh +++ b/hack/lib/util.sh @@ -358,7 +358,7 @@ kube::util::godep_restored() { local root local old_rev="" while read -r path rev; do - rev=$(echo "${rev}" | sed "s/['\"]//g") # remove quotes which are around revs sometimes + rev="${rev//[\'\"]}" # remove quotes which are around revs sometimes if [[ "${rev}" == "${old_rev}" ]] && [[ "${path}" == "${root}"* ]]; then # avoid checking the same git/hg root again