summaryrefslogtreecommitdiff
path: root/printpath
diff options
context:
space:
mode:
authorfilip <“filip.rabiega@gmail.com”>2025-11-06 16:32:49 +0100
committerfilip <“filip.rabiega@gmail.com”>2025-11-06 16:32:49 +0100
commit3806e4ee48ece7f02e7c730ee49d4f830afd165b (patch)
tree0155f3cea2e8c026d7892c71df8520879a21bff2 /printpath
parent0d097e68ef56160b8a7a4c66357ca09a4bdc6ef9 (diff)
downloadchadscripts-3806e4ee48ece7f02e7c730ee49d4f830afd165b.tar.gz
chadscripts-3806e4ee48ece7f02e7c730ee49d4f830afd165b.tar.bz2
chadscripts-3806e4ee48ece7f02e7c730ee49d4f830afd165b.zip
optimized things xoxo
Diffstat (limited to 'printpath')
-rwxr-xr-xprintpath10
1 files changed, 3 insertions, 7 deletions
diff --git a/printpath b/printpath
index 3c59e8f..1a1a605 100755
--- a/printpath
+++ b/printpath
@@ -1,10 +1,6 @@
#!/bin/sh
-# This script is slow, but it works
-IFS=:
-for dir in $PATH; do
- [ -d "$dir" ] || continue
- for file in "$dir"/* "$dir"/.*; do
- [ -f "$file" ] && [ -x "$file" ] && basename "$file"
- done
+echo "$PATH" | tr ':' '\n' | while IFS= read -r dir; do
+ [ -d "$dir" ] || continue
+ find "$dir" -maxdepth 1 -type f -perm -111 -printf '%f\n'
done | sort -u