2007-05-24 04:42:51 +08:00
|
|
|
#!/bin/sh -f
|
2007-05-14 17:56:41 +08:00
|
|
|
CACHE=$HOME/.dmenu_cache
|
2007-02-23 22:28:25 +08:00
|
|
|
IFS=:
|
2007-05-14 17:56:41 +08:00
|
|
|
|
2007-05-24 04:42:51 +08:00
|
|
|
qfind() {
|
|
|
|
find "$@" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2007-05-24 04:13:46 +08:00
|
|
|
uptodate() {
|
2007-05-24 04:42:51 +08:00
|
|
|
test -f $CACHE &&
|
|
|
|
test "$(echo "$PATH")" = "$(sed 1q "$CACHE")" &&
|
|
|
|
qfind $PATH -maxdepth 0 -newer $CACHE
|
|
|
|
}
|
2007-05-14 17:56:41 +08:00
|
|
|
|
2007-05-23 19:22:27 +08:00
|
|
|
if ! uptodate
|
2007-05-14 17:56:41 +08:00
|
|
|
then
|
2007-05-24 04:42:51 +08:00
|
|
|
{
|
|
|
|
echo "$PATH"
|
|
|
|
qfind $PATH -type f -maxdepth 1 -perm -u+x -o -perm -g+x -o -perm -o+x |
|
|
|
|
sed 's,.*/,,' | sort | uniq
|
|
|
|
} > $CACHE.$pid
|
|
|
|
mv $CACHE.$pid $CACHE
|
2007-05-14 17:56:41 +08:00
|
|
|
fi
|
|
|
|
|
2007-05-24 04:42:51 +08:00
|
|
|
tail -n +2 $CACHE
|
|
|
|
|