Replace very cute (ab)use of array to get first element with explicit awk

That is to overcome warnings from shellcheck

	In .clusterfuzzlite/build.sh line 8:
		hash=($(sha256sum "$file"))
			  ^------------------^ SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).

	In .clusterfuzzlite/build.sh line 9:
		cp "$file" "/tmp/oxigraph_$1/$hash"
									 ^---^ SC2128 (warning): Expanding an array without an index only gives the first element.

although original code is making a cute use of an array, if we are to follow
shellcheck and use mapfile or read -a - and then use explicit index -- makes it
just too cumbersome. IMHO  explicit awk would be easier to read etc.
pull/485/head
Yaroslav Halchenko 2 years ago committed by Thomas Tanon
parent 029fbf470e
commit aeeabf5d1c
  1. 2
      .clusterfuzzlite/build.sh

@ -5,7 +5,7 @@ function build_seed_corpus() {
mkdir "/tmp/oxigraph_$1"
for file in **/*."$2"
do
hash=($(sha256sum "$file"))
hash=$(sha256sum "$file" | awk '{print $1;}')
cp "$file" "/tmp/oxigraph_$1/$hash"
done
zip "$1_seed_corpus.zip" /tmp/"oxigraph_$1"/*

Loading…
Cancel
Save