dmenu_path.c (shell is a bottleneck)

This commit is contained in:
Connor Lane Smith 2010-10-08 23:24:22 +01:00
parent 610a0a8d12
commit bf7b8e37ee
3 changed files with 108 additions and 34 deletions

View file

@ -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"