From 0004b8d8f2e1625980120549b94658f0c0c27a71 Mon Sep 17 00:00:00 2001 From: WuChang <3142324836@qq.com> Date: Wed, 31 Jul 2024 14:04:30 +0800 Subject: [PATCH] Fixed CI scripts executable file filter command --- CIUtils/find-elf.sh | 2 +- CIUtils/find-macho.sh | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CIUtils/find-elf.sh b/CIUtils/find-elf.sh index 87394f1..3486615 100644 --- a/CIUtils/find-elf.sh +++ b/CIUtils/find-elf.sh @@ -10,7 +10,7 @@ fi directory=$1 # Find ELF files in the specified directory -files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -q "ELF" && echo "$1"' _ {} \;) +files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -qE "ELF" && echo "$1"' _ {} \;) # Initialize an empty string for the output output="" diff --git a/CIUtils/find-macho.sh b/CIUtils/find-macho.sh index d8dcb4a..700c56c 100644 --- a/CIUtils/find-macho.sh +++ b/CIUtils/find-macho.sh @@ -9,20 +9,20 @@ fi # Directory to search directory=$1 +# Find Mach-O and Universal Binary files in the specified directory +files=$(find "$directory" -type f -exec sh -c 'file -b "$1" | grep -qE "Mach-O|universal binary" && echo "$1"' _ {} \;) + # Initialize an empty string for the output output="" -# Find Mach-O and Universal Binary files in the specified directory -find "$directory" -type f -exec sh -c ' - for file do - if file "$file" | grep -qE "Mach-O|universal binary"; then - if [ -n "$output" ]; then - output="${output}," - fi - output="${output}\"$file\"" - fi - done -' sh {} + +# Loop through each file and format it +for file in $files; do + if [ -z "$output" ]; then + output="\"$file\"" + else + output="$output,\"$file\"" + fi +done -# Print the output +# Print the formatted output echo $output