dmenu_path.c (shell is a bottleneck)
This commit is contained in:
parent
610a0a8d12
commit
bf7b8e37ee
3 changed files with 108 additions and 34 deletions
26
dmenu_path
26
dmenu_path
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
CACHE=$HOME/.dmenu_cache
|
||||
IFS=:
|
||||
|
||||
uptodate() {
|
||||
test -f "$CACHE" &&
|
||||
for dir in $PATH
|
||||
do
|
||||
test ! $dir -nt "$CACHE" || return 1
|
||||
done
|
||||
}
|
||||
|
||||
if ! uptodate
|
||||
then
|
||||
for dir in $PATH
|
||||
do
|
||||
cd "$dir" &&
|
||||
for file in *
|
||||
do
|
||||
test -x "$file" && echo "$file"
|
||||
done
|
||||
done | sort -u > "$CACHE".$$ &&
|
||||
mv "$CACHE".$$ "$CACHE"
|
||||
fi
|
||||
|
||||
cat "$CACHE"
|
Loading…
Add table
Add a link
Reference in a new issue