From 0d6544cdf845f7950c50680059c976cb507b6e45 Mon Sep 17 00:00:00 2001 From: Beat Bolli Date: Sat, 17 Aug 2024 17:34:14 +0200 Subject: [PATCH] check-format-commit: call fewer unneeded processes `wc` does not output a file name if the input is stdin. `awk` reads its file argument; there's no need for `cat`. `sort -u` outputs unique lines. It should be supported on all platforms, as it's specified by POSIX. Reviewed-by: Richard Levitte Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25562) --- util/check-format-commit.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/check-format-commit.sh b/util/check-format-commit.sh index 93f5c22bfcb..cf958923fa0 100755 --- a/util/check-format-commit.sh +++ b/util/check-format-commit.sh @@ -94,7 +94,7 @@ do grep "$i " $TEMPDIR/ranges.txt >> $TEMPDIR/ranges.filter || true done cp $TEMPDIR/ranges.filter $TEMPDIR/ranges.txt -REMAINING_FILES=$(wc -l $TEMPDIR/ranges.filter | awk '{print $1}') +REMAINING_FILES=$(wc -l <$TEMPDIR/ranges.filter) if [ $REMAINING_FILES -eq 0 ] then echo "This commit has no files that require checking" @@ -107,7 +107,7 @@ fi # to $TEMPDIR/check-format. This give us the full file to run # check-format.pl on with line numbers matching the ranges in the # $TEMPDIR/ranges.txt file -for j in $(cat $TEMPDIR/ranges.txt | awk '{print $1}' | sort | uniq) +for j in $(awk '{print $1}' $TEMPDIR/ranges.txt | sort -u) do FDIR=$(dirname $j) mkdir -p $TEMPDIR/check-format/$FDIR @@ -115,7 +115,7 @@ do done # Now for each file in $TEMPDIR/ranges.txt, run check-format.pl -for j in $(cat $TEMPDIR/ranges.txt | awk '{print $1}' | sort | uniq) +for j in $(awk '{print $1}' $TEMPDIR/ranges.txt | sort -u) do range_start=() range_end=() -- 2.47.2