From b5f3618d9a8967b12c902fb7bc9ccdc3b21f6347 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 12 Jul 2024 10:41:11 +0200 Subject: [PATCH] libstd: functions to search for executbales and shared obj added --- Pmodules/libstd.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Pmodules/libstd.bash b/Pmodules/libstd.bash index cec045e..ac4fa84 100644 --- a/Pmodules/libstd.bash +++ b/Pmodules/libstd.bash @@ -343,6 +343,26 @@ std::is_member_of_array(){ done return 1 } + +std::find_executables(){ + ${find} "$@" -type f -printf "%i %P\n" | \ + ${sort} -n -k1 -u | \ + ${awk} '{print $2}' | \ + ${file} -f - | \ + ${awk} '$2 ~ /ELF/ && $3 ~ /64-bit/ && $5 ~ /executable/ {print substr($1, 1, length($1)-1)}' +} + +std::find_shared_objects(){ + ${find} "$@" -type f -printf "%i %P\n" | \ + ${sort} -n -k1 -u | \ + ${awk} '{print $2}' | \ + ${file} -f - | \ + ${awk} '$2 ~ /ELF/ && $3 ~ /64-bit/ && $5 ~ /shared/ && $6 ~ /object/ {print substr($1, 1, length($1)-1)}' +} + +std::get_dir_depth(){ + echo "$1" | ${grep} -o / | wc -l +} # Local Variables: # mode: sh # sh-basic-offset: 8