Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
made dmenu_path the way anydot proposed in response to Jukka
[dmenu.git]
/
dmenu_path
diff --git
a/dmenu_path
b/dmenu_path
index
4ecf4fa
..
cd43748
100755
(executable)
--- a/
dmenu_path
+++ b/
dmenu_path
@@
-1,9
+1,25
@@
#!/bin/sh
#!/bin/sh
+CACHE=$HOME/.dmenu_cache
IFS=:
IFS=:
-for dir in $PATH
-do
- for file in "$dir"/*
+
+uptodate() {
+ test ! -f $CACHE && return 1
+ for dir in $PATH
+ do
+ test $dir -nt $CACHE && return 1
+ done
+ return 0
+}
+
+if ! uptodate
+then
+ for dir in $PATH
do
do
- test -x "$file" && echo "${file##*/}"
- done
-done | sort -u
+ for file in "$dir"/*
+ do
+ test -x "$file" && echo "${file##*/}"
+ done
+ done | sort | uniq > $CACHE
+fi
+
+cat $CACHE