List out bin locations in file

This commit is contained in:
2026-02-04 17:58:51 +09:00
parent 91e4d94cbe
commit 28991c8b41
2 changed files with 48 additions and 19 deletions

22
BIN_LOCATIONS.txt Normal file
View File

@@ -0,0 +1,22 @@
/store/bin
/store/gnu/bin
/usr/bin
/usr/local/bin
/local/bin
/opt/bin
/opt/local/bin
/sbin
/usr/sbin
/usr/local/sbin
/opt/sbin
/var/qmail/bin
/usr/drwho/local/bin
/usr/local/mlog3/bin
/usr/local/flite/bin
/opt/flite/bin
/opt/csw/bin
/sw/bin
/usr/sfw/bin
/perl/bin
/usr/local/php/bin
/usr/X11R6/bin

45
run.sh
View File

@@ -73,25 +73,32 @@ fi
cat "$OUTPUT_DIR/php-libs.txt" | sort | uniq -c | sort -gr > "$OUTPUT_DIR/php-libs-overview.txt"
find \
/home/pvv/?/*/web-docs \
-type f \
\( \
-name '*.cgi' \
-o -name '*.php' \
-o -name '*.php3' \
-o -name '*.pm' \
-o -name '*.pl' \
-o -name '*.sh' \
-o -name '*.bash' \
-o -name '*.phtml' \
-o -name '*.shtml' \
-o -name '*.lisp' \
-o -name '*.cl' \
\) \
-exec rg '(?:/store/bin|/store/gnu/bin|/usr/bin|/usr/local/bin|/local/bin|/opt/bin|/opt/local/bin|/sbin|/usr/sbin|/usr/local/sbin|/opt/sbin|/var/qmail/bin|/usr/drwho/local/bin|/usr/local/mlog3/bin|/usr/local/flite/bin|/opt/flite/bin|/opt/csw/bin|/sw/bin|/usr/sfw/bin|/perl/bin|/usr/local/php/bin|/usr/X11R6/bin)/(?:env\s*)?(\w+(?:/\w+)*)' {} -N -o -r '$1' \; \
2>/dev/null \
| tee "$OUTPUT_DIR/cgi-progs.txt"
if [[ ! -f "$OUTPUT_DIR/cgi-progs.txt" ]]; then
readarray -t BIN_LOCATIONS < BIN_LOCATIONS.txt
bin_locations_regex=$(printf '|%s' "${BIN_LOCATIONS[@]}")
bin_locations_regex="${bin_locations_regex:1}" # remove leading '|'
bin_locations_regex="(?:${bin_locations_regex})"
find \
/home/pvv/?/*/web-docs \
-type f \
\( \
-name '*.cgi' \
-o -name '*.php' \
-o -name '*.php3' \
-o -name '*.pm' \
-o -name '*.pl' \
-o -name '*.sh' \
-o -name '*.bash' \
-o -name '*.phtml' \
-o -name '*.shtml' \
-o -name '*.lisp' \
-o -name '*.cl' \
\) \
-exec rg "$bin_locations_regex/(?:env\s*)?(\w+(?:/\w+)*)" {} -N -o -r '$1' \; \
2>/dev/null \
| tee "$OUTPUT_DIR/cgi-progs.txt"
fi
cat "$OUTPUT_DIR/cgi-progs.txt" | sort | uniq -c | sort -gr > "$OUTPUT_DIR/cgi-progs-overview.txt"