Skip to content

Commit 1e34d9d

Browse files
committed
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
1 parent 0078fce commit 1e34d9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hack/lib/util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ kube::util::godep_restored() {
358358
local root
359359
local old_rev=""
360360
while read -r path rev; do
361-
rev=$(echo "${rev}" | sed "s/['\"]//g") # remove quotes which are around revs sometimes
361+
rev="${rev//[\'\"]}" # remove quotes which are around revs sometimes
362362

363363
if [[ "${rev}" == "${old_rev}" ]] && [[ "${path}" == "${root}"* ]]; then
364364
# avoid checking the same git/hg root again

0 commit comments

Comments
 (0)