From 223c65015c73e7063d9c45ab57aaae9b136f5bbf Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 13 Oct 2017 11:45:06 +0200 Subject: [PATCH] kpatch-build: further shell code cleanup Replace find * with find ./* to prevent treating files with dashes as options. The leading ./ is later used in comparisons and thus must be removed before that. Found by shellcheck. --- kpatch-build/kpatch-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index 2336dc8..a5c3d05 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -290,8 +290,8 @@ find_parent_obj() { num="$(grep -l "$grepname" "$last_deep_find"/.*.cmd | grep -vc "$pdir/.${file}.cmd")" fi if [[ "$num" -eq 0 ]]; then - parent="$(find * -name ".*.cmd" -print0 | xargs -0 grep -l "$grepname" | grep -v "$pdir/.${file}.cmd" |head -n1)" - num="$(find * -name ".*.cmd" -print0 | xargs -0 grep -l "$grepname" | grep -vc "$pdir/.${file}.cmd")" + parent="$(find ./* -name ".*.cmd" -print0 | xargs -0 grep -l "$grepname" | grep -v "$pdir/.${file}.cmd" | cut -c3- | head -n1)" + num="$(find ./* -name ".*.cmd" -print0 | xargs -0 grep -l "$grepname" | grep -vc "$pdir/.${file}.cmd")" [[ "$num" -eq 1 ]] && last_deep_find="$(dirname "$parent")" fi else